editorActions.ts 50.0 KB
Newer Older
E
Erich Gamma 已提交
1 2 3 4 5
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

6
import * as nls from 'vs/nls';
J
Johannes Rieken 已提交
7
import { Action } from 'vs/base/common/actions';
8
import { mixin } from 'vs/base/common/objects';
B
Benjamin Pasero 已提交
9
import { IEditorInput, EditorInput, IEditorIdentifier, ConfirmResult, IEditorCommandsContext, CloseDirection } from 'vs/workbench/common/editor';
J
Johannes Rieken 已提交
10 11
import { QuickOpenEntryGroup } from 'vs/base/parts/quickopen/browser/quickOpenModel';
import { EditorQuickOpenEntry, EditorQuickOpenEntryGroup, IEditorQuickOpenEntry, QuickOpenAction } from 'vs/workbench/browser/quickopen';
J
Johannes Rieken 已提交
12
import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen';
J
Johannes Rieken 已提交
13
import { IPartService } from 'vs/workbench/services/part/common/partService';
B
Benjamin Pasero 已提交
14
import { IResourceInput } from 'vs/platform/editor/common/editor';
J
Johannes Rieken 已提交
15 16 17
import { IHistoryService } from 'vs/workbench/services/history/common/history';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { ICommandService } from 'vs/platform/commands/common/commands';
18
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
C
22768  
Cristian 已提交
19
import { IWindowsService } from 'vs/platform/windows/common/windows';
20
import { CLOSE_EDITOR_COMMAND_ID, NAVIGATE_ALL_EDITORS_GROUP_PREFIX, MOVE_ACTIVE_EDITOR_COMMAND_ID, NAVIGATE_IN_ACTIVE_GROUP_PREFIX, ActiveEditorMoveArguments, SPLIT_EDITOR_LEFT, SPLIT_EDITOR_RIGHT, SPLIT_EDITOR_UP, SPLIT_EDITOR_DOWN, splitEditor, LAYOUT_EDITOR_GROUPS_COMMAND_ID, mergeAllGroups } from 'vs/workbench/browser/parts/editor/editorCommands';
21
import { IEditorGroupsService, IEditorGroup, GroupsArrangement, EditorsOrder, GroupLocation, GroupDirection, preferredSideBySideGroupDirection, IFindGroupScope, GroupOrientation, EditorGroupLayout, GroupsOrder } from 'vs/workbench/services/group/common/editorGroupsService';
22
import { IEditorService, SIDE_GROUP } from 'vs/workbench/services/editor/common/editorService';
B
Benjamin Pasero 已提交
23
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
24
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
E
Erich Gamma 已提交
25

26 27 28 29 30 31 32 33 34 35 36 37
export class ExecuteCommandAction extends Action {

	constructor(
		id: string,
		label: string,
		private commandId: string,
		private commandService: ICommandService,
		private commandArgs?: any
	) {
		super(id, label);
	}

J
Johannes Rieken 已提交
38
	run(): Promise<any> {
39 40 41 42
		return this.commandService.executeCommand(this.commandId, this.commandArgs);
	}
}

43
export class BaseSplitEditorAction extends Action {
44
	private toDispose: IDisposable[] = [];
45
	private direction: GroupDirection;
46

47 48 49
	constructor(
		id: string,
		label: string,
50 51
		protected editorGroupService: IEditorGroupsService,
		protected configurationService: IConfigurationService
52
	) {
53 54
		super(id, label);

55
		this.direction = this.getDirection();
56 57 58 59

		this.registerListeners();
	}

60 61 62 63
	protected getDirection(): GroupDirection {
		return preferredSideBySideGroupDirection(this.configurationService);
	}

64 65 66
	private registerListeners(): void {
		this.toDispose.push(this.configurationService.onDidChangeConfiguration(e => {
			if (e.affectsConfiguration('workbench.editor.openSideBySideDirection')) {
67
				this.direction = preferredSideBySideGroupDirection(this.configurationService);
68 69 70 71
			}
		}));
	}

B
Benjamin Pasero 已提交
72
	run(context?: IEditorIdentifier): Promise<any> {
73
		splitEditor(this.editorGroupService, this.direction, context);
74

B
Benjamin Pasero 已提交
75
		return Promise.resolve(true);
76 77
	}

B
Benjamin Pasero 已提交
78
	dispose(): void {
79 80 81
		super.dispose();

		this.toDispose = dispose(this.toDispose);
82 83 84
	}
}

85 86
export class SplitEditorAction extends BaseSplitEditorAction {

B
Benjamin Pasero 已提交
87 88
	static readonly ID = 'workbench.action.splitEditor';
	static readonly LABEL = nls.localize('splitEditor', "Split Editor");
89 90 91 92 93 94 95 96 97 98 99 100 101

	constructor(
		id: string,
		label: string,
		@IEditorGroupsService editorGroupService: IEditorGroupsService,
		@IConfigurationService configurationService: IConfigurationService
	) {
		super(id, label, editorGroupService, configurationService);
	}
}

export class SplitEditorOrthogonalAction extends BaseSplitEditorAction {

B
Benjamin Pasero 已提交
102 103
	static readonly ID = 'workbench.action.splitEditorOrthogonal';
	static readonly LABEL = nls.localize('splitEditorOrthogonal', "Split Editor Orthogonal");
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120

	constructor(
		id: string,
		label: string,
		@IEditorGroupsService editorGroupService: IEditorGroupsService,
		@IConfigurationService configurationService: IConfigurationService
	) {
		super(id, label, editorGroupService, configurationService);
	}

	protected getDirection(): GroupDirection {
		const direction = preferredSideBySideGroupDirection(this.configurationService);

		return direction === GroupDirection.RIGHT ? GroupDirection.DOWN : GroupDirection.RIGHT;
	}
}

121
export class SplitEditorLeftAction extends ExecuteCommandAction {
122

B
Benjamin Pasero 已提交
123 124
	static readonly ID = SPLIT_EDITOR_LEFT;
	static readonly LABEL = nls.localize('splitEditorGroupLeft', "Split Editor Left");
125 126 127 128

	constructor(
		id: string,
		label: string,
129
		@ICommandService commandService: ICommandService
130
	) {
131
		super(id, label, SPLIT_EDITOR_LEFT, commandService);
B
Benjamin Pasero 已提交
132 133 134
	}
}

135
export class SplitEditorRightAction extends ExecuteCommandAction {
B
Benjamin Pasero 已提交
136

B
Benjamin Pasero 已提交
137 138
	static readonly ID = SPLIT_EDITOR_RIGHT;
	static readonly LABEL = nls.localize('splitEditorGroupRight', "Split Editor Right");
B
Benjamin Pasero 已提交
139 140 141 142

	constructor(
		id: string,
		label: string,
143
		@ICommandService commandService: ICommandService
B
Benjamin Pasero 已提交
144
	) {
145
		super(id, label, SPLIT_EDITOR_RIGHT, commandService);
B
Benjamin Pasero 已提交
146 147 148
	}
}

149
export class SplitEditorUpAction extends ExecuteCommandAction {
B
Benjamin Pasero 已提交
150

B
Benjamin Pasero 已提交
151 152
	static readonly ID = SPLIT_EDITOR_UP;
	static readonly LABEL = nls.localize('splitEditorGroupUp', "Split Editor Up");
153

B
Benjamin Pasero 已提交
154 155 156
	constructor(
		id: string,
		label: string,
157
		@ICommandService commandService: ICommandService
B
Benjamin Pasero 已提交
158
	) {
159
		super(id, label, SPLIT_EDITOR_UP, commandService);
160
	}
B
Benjamin Pasero 已提交
161
}
162

163
export class SplitEditorDownAction extends ExecuteCommandAction {
164

B
Benjamin Pasero 已提交
165 166
	static readonly ID = SPLIT_EDITOR_DOWN;
	static readonly LABEL = nls.localize('splitEditorGroupDown', "Split Editor Down");
167

B
Benjamin Pasero 已提交
168 169 170
	constructor(
		id: string,
		label: string,
171
		@ICommandService commandService: ICommandService
B
Benjamin Pasero 已提交
172
	) {
173
		super(id, label, SPLIT_EDITOR_DOWN, commandService);
174 175 176
	}
}

177
export class JoinTwoGroupsAction extends Action {
I
initialshl 已提交
178

B
Benjamin Pasero 已提交
179 180
	static readonly ID = 'workbench.action.joinTwoGroups';
	static readonly LABEL = nls.localize('joinTwoGroups', "Join Editor Group with Next Group");
I
initialshl 已提交
181 182 183 184

	constructor(
		id: string,
		label: string,
185
		@IEditorGroupsService private editorGroupService: IEditorGroupsService
I
initialshl 已提交
186
	) {
187
		super(id, label);
I
initialshl 已提交
188 189
	}

B
Benjamin Pasero 已提交
190
	run(context?: IEditorIdentifier): Promise<any> {
191
		let sourceGroup: IEditorGroup;
B
Benjamin Pasero 已提交
192 193
		if (context && typeof context.groupId === 'number') {
			sourceGroup = this.editorGroupService.getGroup(context.groupId);
I
initialshl 已提交
194
		} else {
B
Benjamin Pasero 已提交
195
			sourceGroup = this.editorGroupService.activeGroup;
I
initialshl 已提交
196 197
		}

198
		const targetGroupDirections = [GroupDirection.RIGHT, GroupDirection.DOWN, GroupDirection.LEFT, GroupDirection.UP];
199 200
		for (const targetGroupDirection of targetGroupDirections) {
			const targetGroup = this.editorGroupService.findGroup({ direction: targetGroupDirection }, sourceGroup);
201 202 203
			if (targetGroup && sourceGroup !== targetGroup) {
				this.editorGroupService.mergeGroup(sourceGroup, targetGroup);

B
Benjamin Pasero 已提交
204
				return Promise.resolve(true);
205
			}
B
Benjamin Pasero 已提交
206
		}
I
initialshl 已提交
207

B
Benjamin Pasero 已提交
208
		return Promise.resolve(true);
I
initialshl 已提交
209 210 211
	}
}

212 213
export class JoinAllGroupsAction extends Action {

B
Benjamin Pasero 已提交
214 215
	static readonly ID = 'workbench.action.joinAllGroups';
	static readonly LABEL = nls.localize('joinAllGroups', "Join All Editor Groups");
216 217 218 219 220 221 222 223 224

	constructor(
		id: string,
		label: string,
		@IEditorGroupsService private editorGroupService: IEditorGroupsService
	) {
		super(id, label);
	}

B
Benjamin Pasero 已提交
225
	run(context?: IEditorIdentifier): Promise<any> {
226
		mergeAllGroups(this.editorGroupService);
227

B
Benjamin Pasero 已提交
228
		return Promise.resolve(true);
229 230 231
	}
}

B
Benjamin Pasero 已提交
232
export class NavigateBetweenGroupsAction extends Action {
233

B
Benjamin Pasero 已提交
234 235
	static readonly ID = 'workbench.action.navigateEditorGroups';
	static readonly LABEL = nls.localize('navigateEditorGroups', "Navigate Between Editor Groups");
E
Erich Gamma 已提交
236

237 238 239
	constructor(
		id: string,
		label: string,
240
		@IEditorGroupsService private editorGroupService: IEditorGroupsService
241
	) {
E
Erich Gamma 已提交
242 243 244
		super(id, label);
	}

J
Johannes Rieken 已提交
245
	run(): Promise<any> {
B
Benjamin Pasero 已提交
246
		const nextGroup = this.editorGroupService.findGroup({ location: GroupLocation.NEXT }, this.editorGroupService.activeGroup, true);
B
Benjamin Pasero 已提交
247
		nextGroup.focus();
248

B
Benjamin Pasero 已提交
249
		return Promise.resolve(true);
E
Erich Gamma 已提交
250 251 252
	}
}

253 254
export class FocusActiveGroupAction extends Action {

B
Benjamin Pasero 已提交
255 256
	static readonly ID = 'workbench.action.focusActiveEditorGroup';
	static readonly LABEL = nls.localize('focusActiveEditorGroup', "Focus Active Editor Group");
257 258 259 260

	constructor(
		id: string,
		label: string,
261
		@IEditorGroupsService private editorGroupService: IEditorGroupsService
262 263 264 265
	) {
		super(id, label);
	}

J
Johannes Rieken 已提交
266
	run(): Promise<any> {
B
Benjamin Pasero 已提交
267
		this.editorGroupService.activeGroup.focus();
D
Daniel Imms 已提交
268

B
Benjamin Pasero 已提交
269
		return Promise.resolve(true);
E
Erich Gamma 已提交
270 271 272
	}
}

273
export abstract class BaseFocusGroupAction extends Action {
E
Erich Gamma 已提交
274 275 276 277

	constructor(
		id: string,
		label: string,
278
		private scope: IFindGroupScope,
279
		@IEditorGroupsService private editorGroupService: IEditorGroupsService
E
Erich Gamma 已提交
280 281 282 283
	) {
		super(id, label);
	}

J
Johannes Rieken 已提交
284
	run(): Promise<any> {
B
Benjamin Pasero 已提交
285
		const group = this.editorGroupService.findGroup(this.scope, this.editorGroupService.activeGroup, true);
286 287 288
		if (group) {
			group.focus();
		}
E
Erich Gamma 已提交
289

B
Benjamin Pasero 已提交
290
		return Promise.resolve(true);
E
Erich Gamma 已提交
291 292 293
	}
}

294 295
export class FocusFirstGroupAction extends BaseFocusGroupAction {

B
Benjamin Pasero 已提交
296 297
	static readonly ID = 'workbench.action.focusFirstEditorGroup';
	static readonly LABEL = nls.localize('focusFirstEditorGroup', "Focus First Editor Group");
298 299 300 301 302 303 304 305 306 307 308

	constructor(
		id: string,
		label: string,
		@IEditorGroupsService editorGroupService: IEditorGroupsService
	) {
		super(id, label, { location: GroupLocation.FIRST }, editorGroupService);
	}
}

export class FocusLastGroupAction extends BaseFocusGroupAction {
B
Benjamin Pasero 已提交
309

B
Benjamin Pasero 已提交
310 311
	static readonly ID = 'workbench.action.focusLastEditorGroup';
	static readonly LABEL = nls.localize('focusLastEditorGroup', "Focus Last Editor Group");
E
Erich Gamma 已提交
312 313 314 315

	constructor(
		id: string,
		label: string,
316
		@IEditorGroupsService editorGroupService: IEditorGroupsService
E
Erich Gamma 已提交
317
	) {
318
		super(id, label, { location: GroupLocation.LAST }, editorGroupService);
E
Erich Gamma 已提交
319
	}
320
}
E
Erich Gamma 已提交
321

322
export class FocusNextGroup extends BaseFocusGroupAction {
E
Erich Gamma 已提交
323

B
Benjamin Pasero 已提交
324 325
	static readonly ID = 'workbench.action.focusNextGroup';
	static readonly LABEL = nls.localize('focusNextGroup', "Focus Next Editor Group");
326 327 328 329 330 331 332

	constructor(
		id: string,
		label: string,
		@IEditorGroupsService editorGroupService: IEditorGroupsService
	) {
		super(id, label, { location: GroupLocation.NEXT }, editorGroupService);
E
Erich Gamma 已提交
333 334 335
	}
}

336
export class FocusPreviousGroup extends BaseFocusGroupAction {
337

B
Benjamin Pasero 已提交
338 339
	static readonly ID = 'workbench.action.focusPreviousGroup';
	static readonly LABEL = nls.localize('focusPreviousGroup', "Focus Previous Editor Group");
E
Erich Gamma 已提交
340

341 342 343
	constructor(
		id: string,
		label: string,
344
		@IEditorGroupsService editorGroupService: IEditorGroupsService
345
	) {
346
		super(id, label, { location: GroupLocation.PREVIOUS }, editorGroupService);
E
Erich Gamma 已提交
347
	}
348
}
E
Erich Gamma 已提交
349

350
export class FocusLeftGroup extends BaseFocusGroupAction {
E
Erich Gamma 已提交
351

B
Benjamin Pasero 已提交
352 353
	static readonly ID = 'workbench.action.focusLeftGroup';
	static readonly LABEL = nls.localize('focusLeftGroup', "Focus Left Editor Group");
354 355 356 357 358 359 360

	constructor(
		id: string,
		label: string,
		@IEditorGroupsService editorGroupService: IEditorGroupsService
	) {
		super(id, label, { direction: GroupDirection.LEFT }, editorGroupService);
E
Erich Gamma 已提交
361 362 363
	}
}

364
export class FocusRightGroup extends BaseFocusGroupAction {
365

B
Benjamin Pasero 已提交
366 367
	static readonly ID = 'workbench.action.focusRightGroup';
	static readonly LABEL = nls.localize('focusRightGroup', "Focus Right Editor Group");
368

E
Erich Gamma 已提交
369 370 371
	constructor(
		id: string,
		label: string,
372
		@IEditorGroupsService editorGroupService: IEditorGroupsService
E
Erich Gamma 已提交
373
	) {
374
		super(id, label, { direction: GroupDirection.RIGHT }, editorGroupService);
E
Erich Gamma 已提交
375
	}
376
}
E
Erich Gamma 已提交
377

378
export class FocusAboveGroup extends BaseFocusGroupAction {
E
Erich Gamma 已提交
379

B
Benjamin Pasero 已提交
380 381
	static readonly ID = 'workbench.action.focusAboveGroup';
	static readonly LABEL = nls.localize('focusAboveGroup', "Focus Above Editor Group");
382 383 384 385 386 387 388

	constructor(
		id: string,
		label: string,
		@IEditorGroupsService editorGroupService: IEditorGroupsService
	) {
		super(id, label, { direction: GroupDirection.UP }, editorGroupService);
E
Erich Gamma 已提交
389 390 391
	}
}

392 393
export class FocusBelowGroup extends BaseFocusGroupAction {

B
Benjamin Pasero 已提交
394 395
	static readonly ID = 'workbench.action.focusBelowGroup';
	static readonly LABEL = nls.localize('focusBelowGroup', "Focus Below Editor Group");
396 397 398 399 400 401 402 403 404 405

	constructor(
		id: string,
		label: string,
		@IEditorGroupsService editorGroupService: IEditorGroupsService
	) {
		super(id, label, { direction: GroupDirection.DOWN }, editorGroupService);
	}
}

406
export class OpenToSideFromQuickOpenAction extends Action {
E
Erich Gamma 已提交
407

B
Benjamin Pasero 已提交
408 409
	static readonly OPEN_TO_SIDE_ID = 'workbench.action.openToSide';
	static readonly OPEN_TO_SIDE_LABEL = nls.localize('openToSide', "Open to the Side");
E
Erich Gamma 已提交
410

411
	constructor(
412
		@IEditorService private editorService: IEditorService,
B
Benjamin Pasero 已提交
413
		@IConfigurationService private configurationService: IConfigurationService
414
	) {
415
		super(OpenToSideFromQuickOpenAction.OPEN_TO_SIDE_ID, OpenToSideFromQuickOpenAction.OPEN_TO_SIDE_LABEL);
E
Erich Gamma 已提交
416

417 418 419
		this.updateClass();
	}

B
Benjamin Pasero 已提交
420
	updateClass(): void {
421
		const preferredDirection = preferredSideBySideGroupDirection(this.configurationService);
E
Erich Gamma 已提交
422

423
		this.class = (preferredDirection === GroupDirection.RIGHT) ? 'quick-open-sidebyside-vertical' : 'quick-open-sidebyside-horizontal';
E
Erich Gamma 已提交
424 425
	}

J
Johannes Rieken 已提交
426
	run(context: any): Promise<any> {
B
Benjamin Pasero 已提交
427
		const entry = toEditorQuickOpenEntry(context);
E
Erich Gamma 已提交
428
		if (entry) {
429
			const input = entry.getInput();
B
Benjamin Pasero 已提交
430
			if (input instanceof EditorInput) {
B
Benjamin Pasero 已提交
431
				return this.editorService.openEditor(input, entry.getOptions(), SIDE_GROUP);
B
Benjamin Pasero 已提交
432 433
			}

434 435 436
			const resourceInput = input as IResourceInput;
			resourceInput.options = mixin(resourceInput.options, entry.getOptions());

B
Benjamin Pasero 已提交
437
			return this.editorService.openEditor(resourceInput, SIDE_GROUP);
E
Erich Gamma 已提交
438 439
		}

B
Benjamin Pasero 已提交
440
		return Promise.resolve(false);
E
Erich Gamma 已提交
441 442 443
	}
}

444
export function toEditorQuickOpenEntry(element: any): IEditorQuickOpenEntry {
E
Erich Gamma 已提交
445 446 447

	// QuickOpenEntryGroup
	if (element instanceof QuickOpenEntryGroup) {
448
		const group = <QuickOpenEntryGroup>element;
E
Erich Gamma 已提交
449 450 451 452 453 454 455 456 457 458 459 460 461 462
		if (group.getEntry()) {
			element = group.getEntry();
		}
	}

	// EditorQuickOpenEntry or EditorQuickOpenEntryGroup both implement IEditorQuickOpenEntry
	if (element instanceof EditorQuickOpenEntry || element instanceof EditorQuickOpenEntryGroup) {
		return element;
	}

	return null;
}

export class CloseEditorAction extends Action {
463

B
Benjamin Pasero 已提交
464 465
	static readonly ID = 'workbench.action.closeActiveEditor';
	static readonly LABEL = nls.localize('closeEditor', "Close Editor");
466

467 468 469
	constructor(
		id: string,
		label: string,
I
isidor 已提交
470
		@ICommandService private commandService: ICommandService
471
	) {
I
isidor 已提交
472
		super(id, label, 'close-editor-action');
E
Erich Gamma 已提交
473 474
	}

B
Benjamin Pasero 已提交
475
	run(context?: IEditorCommandsContext): Promise<any> {
R
Rob Lourens 已提交
476
		return this.commandService.executeCommand(CLOSE_EDITOR_COMMAND_ID, undefined, context);
E
Erich Gamma 已提交
477 478 479
	}
}

480 481
export class CloseOneEditorAction extends Action {

B
Benjamin Pasero 已提交
482 483
	static readonly ID = 'workbench.action.closeActiveEditor';
	static readonly LABEL = nls.localize('closeOneEditor', "Close");
484 485 486 487

	constructor(
		id: string,
		label: string,
488
		@IEditorGroupsService private editorGroupService: IEditorGroupsService
489 490 491 492
	) {
		super(id, label, 'close-editor-action');
	}

J
Johannes Rieken 已提交
493
	run(context?: IEditorCommandsContext): Promise<any> {
494
		let group: IEditorGroup;
495 496
		let editorIndex: number;
		if (context) {
497
			group = this.editorGroupService.getGroup(context.groupId);
498

499 500
			if (group) {
				editorIndex = context.editorIndex; // only allow editor at index if group is valid
501 502 503
			}
		}

504
		if (!group) {
505
			group = this.editorGroupService.activeGroup;
506 507
		}

508 509 510 511
		// Close specific editor in group
		if (typeof editorIndex === 'number') {
			const editorAtIndex = group.getEditor(editorIndex);
			if (editorAtIndex) {
512
				return group.closeEditor(editorAtIndex);
513 514 515 516 517
			}
		}

		// Otherwise close active editor in group
		if (group.activeEditor) {
518
			return group.closeEditor(group.activeEditor);
519 520
		}

B
Benjamin Pasero 已提交
521
		return Promise.resolve(false);
522 523 524
	}
}

M
misoguy 已提交
525 526
export class RevertAndCloseEditorAction extends Action {

B
Benjamin Pasero 已提交
527 528
	static readonly ID = 'workbench.action.revertAndCloseActiveEditor';
	static readonly LABEL = nls.localize('revertAndCloseActiveEditor', "Revert and Close Editor");
M
misoguy 已提交
529 530 531 532

	constructor(
		id: string,
		label: string,
533
		@IEditorService private editorService: IEditorService
M
misoguy 已提交
534 535 536 537
	) {
		super(id, label);
	}

J
Johannes Rieken 已提交
538
	run(): Promise<any> {
B
Benjamin Pasero 已提交
539
		const activeControl = this.editorService.activeControl;
B
Benjamin Pasero 已提交
540
		if (activeControl) {
B
Benjamin Pasero 已提交
541
			const editor = activeControl.input;
542
			const group = activeControl.group;
B
Benjamin Pasero 已提交
543

544
			// first try a normal revert where the contents of the editor are restored
B
Benjamin Pasero 已提交
545
			return editor.revert().then(() => group.closeEditor(editor), error => {
546 547 548 549
				// if that fails, since we are about to close the editor, we accept that
				// the editor cannot be reverted and instead do a soft revert that just
				// enables us to close the editor. With this, a user can always close a
				// dirty editor even when reverting fails.
B
Benjamin Pasero 已提交
550
				return editor.revert({ soft: true }).then(() => group.closeEditor(editor));
551
			});
M
misoguy 已提交
552 553
		}

B
Benjamin Pasero 已提交
554
		return Promise.resolve(false);
M
misoguy 已提交
555 556 557
	}
}

B
Benjamin Pasero 已提交
558
export class CloseLeftEditorsInGroupAction extends Action {
559

B
Benjamin Pasero 已提交
560 561
	static readonly ID = 'workbench.action.closeEditorsToTheLeft';
	static readonly LABEL = nls.localize('closeEditorsToTheLeft', "Close Editors to the Left in Group");
562

563 564 565
	constructor(
		id: string,
		label: string,
566
		@IEditorService private editorService: IEditorService,
B
Benjamin Pasero 已提交
567
		@IEditorGroupsService private editorGroupService: IEditorGroupsService
568
	) {
569 570 571
		super(id, label);
	}

J
Johannes Rieken 已提交
572
	run(context?: IEditorIdentifier): Promise<any> {
B
Benjamin Pasero 已提交
573
		const { group, editor } = getTarget(this.editorService, this.editorGroupService, context);
B
Benjamin Pasero 已提交
574 575
		if (group && editor) {
			return group.closeEditors({ direction: CloseDirection.LEFT, except: editor });
576 577
		}

B
Benjamin Pasero 已提交
578
		return Promise.resolve(false);
579 580 581
	}
}

582
function getTarget(editorService: IEditorService, editorGroupService: IEditorGroupsService, context?: IEditorIdentifier): { editor: IEditorInput, group: IEditorGroup } {
B
Benjamin Pasero 已提交
583 584 585 586 587 588 589 590
	if (context) {
		return { editor: context.editor, group: editorGroupService.getGroup(context.groupId) };
	}

	// Fallback to active group
	return { group: editorGroupService.activeGroup, editor: editorGroupService.activeGroup.activeEditor };
}

591
export abstract class BaseCloseAllAction extends Action {
592

593 594 595
	constructor(
		id: string,
		label: string,
596
		clazz: string,
597 598
		private textFileService: ITextFileService,
		protected editorGroupService: IEditorGroupsService
599
	) {
600
		super(id, label, clazz);
E
Erich Gamma 已提交
601 602
	}

603 604 605 606 607 608 609 610 611 612 613 614 615 616
	protected get groupsToClose(): IEditorGroup[] {
		const groupsToClose: IEditorGroup[] = [];

		// Close editors in reverse order of their grid appearance so that the editor
		// group that is the first (top-left) remains. This helps to keep view state
		// for editors around that have been opened in this visually first group.
		const groups = this.editorGroupService.getGroups(GroupsOrder.GRID_APPEARANCE);
		for (let i = groups.length - 1; i >= 0; i--) {
			groupsToClose.push(groups[i]);
		}

		return groupsToClose;
	}

J
Johannes Rieken 已提交
617
	run(): Promise<any> {
618 619 620

		// Just close all if there are no or one dirty editor
		if (this.textFileService.getDirty().length < 2) {
621
			return this.doCloseAll();
622 623 624
		}

		// Otherwise ask for combined confirmation
625 626
		return this.textFileService.confirmSave().then(confirm => {
			if (confirm === ConfirmResult.CANCEL) {
R
Rob Lourens 已提交
627
				return undefined;
628
			}
629

J
Johannes Rieken 已提交
630
			let saveOrRevertPromise: Promise<boolean>;
631 632 633 634
			if (confirm === ConfirmResult.DONT_SAVE) {
				saveOrRevertPromise = this.textFileService.revertAll(null, { soft: true }).then(() => true);
			} else {
				saveOrRevertPromise = this.textFileService.saveAll(true).then(res => res.results.every(r => r.success));
635
			}
636

637 638
			return saveOrRevertPromise.then(success => {
				if (success) {
639
					return this.doCloseAll();
640 641
				}

R
Rob Lourens 已提交
642
				return undefined;
643
			});
644
		});
E
Erich Gamma 已提交
645
	}
646

J
Johannes Rieken 已提交
647
	protected abstract doCloseAll(): Promise<any>;
648 649 650 651
}

export class CloseAllEditorsAction extends BaseCloseAllAction {

B
Benjamin Pasero 已提交
652 653
	static readonly ID = 'workbench.action.closeAllEditors';
	static readonly LABEL = nls.localize('closeAllEditors', "Close All Editors");
654 655 656 657 658

	constructor(
		id: string,
		label: string,
		@ITextFileService textFileService: ITextFileService,
659
		@IEditorGroupsService editorGroupService: IEditorGroupsService
660
	) {
661
		super(id, label, 'action-close-all-files', textFileService, editorGroupService);
662 663
	}

B
Benjamin Pasero 已提交
664
	protected doCloseAll(): Promise<any> {
I
isidor 已提交
665
		return Promise.all(this.groupsToClose.map(g => g.closeAllEditors()));
666 667 668 669 670
	}
}

export class CloseAllEditorGroupsAction extends BaseCloseAllAction {

B
Benjamin Pasero 已提交
671 672
	static readonly ID = 'workbench.action.closeAllGroups';
	static readonly LABEL = nls.localize('closeAllGroups', "Close All Editor Groups");
673 674 675 676 677

	constructor(
		id: string,
		label: string,
		@ITextFileService textFileService: ITextFileService,
678
		@IEditorGroupsService editorGroupService: IEditorGroupsService
679
	) {
R
Rob Lourens 已提交
680
		super(id, label, undefined, textFileService, editorGroupService);
681 682
	}

B
Benjamin Pasero 已提交
683
	protected doCloseAll(): Promise<any> {
I
isidor 已提交
684
		return Promise.all(this.groupsToClose.map(g => g.closeAllEditors())).then(() => {
685
			this.groupsToClose.forEach(group => this.editorGroupService.removeGroup(group));
686 687
		});
	}
E
Erich Gamma 已提交
688 689
}

690 691
export class CloseEditorsInOtherGroupsAction extends Action {

B
Benjamin Pasero 已提交
692 693
	static readonly ID = 'workbench.action.closeEditorsInOtherGroups';
	static readonly LABEL = nls.localize('closeEditorsInOtherGroups', "Close Editors in Other Groups");
694

695 696 697
	constructor(
		id: string,
		label: string,
698
		@IEditorGroupsService private editorGroupService: IEditorGroupsService,
699
	) {
700 701 702
		super(id, label);
	}

J
Johannes Rieken 已提交
703
	run(context?: IEditorIdentifier): Promise<any> {
I
isidor 已提交
704
		const groupToSkip = context ? this.editorGroupService.getGroup(context.groupId) : this.editorGroupService.activeGroup;
I
isidor 已提交
705
		return Promise.all(this.editorGroupService.getGroups(GroupsOrder.MOST_RECENTLY_ACTIVE).map(g => {
I
isidor 已提交
706
			if (g.id === groupToSkip.id) {
B
Benjamin Pasero 已提交
707
				return Promise.resolve(null);
708 709
			}

I
isidor 已提交
710 711
			return g.closeAllEditors();
		}));
712 713 714
	}
}

B
Benjamin Pasero 已提交
715 716 717 718 719 720 721 722 723 724 725 726 727 728
export class CloseEditorInAllGroupsAction extends Action {

	static readonly ID = 'workbench.action.closeEditorInAllGroups';
	static readonly LABEL = nls.localize('closeEditorInAllGroups', "Close Editor in All Groups");

	constructor(
		id: string,
		label: string,
		@IEditorGroupsService private editorGroupService: IEditorGroupsService,
		@IEditorService private editorService: IEditorService
	) {
		super(id, label);
	}

J
Johannes Rieken 已提交
729
	run(): Promise<any> {
B
Benjamin Pasero 已提交
730 731
		const activeEditor = this.editorService.activeEditor;
		if (activeEditor) {
I
isidor 已提交
732
			return Promise.all(this.editorGroupService.getGroups(GroupsOrder.MOST_RECENTLY_ACTIVE).map(g => g.closeEditor(activeEditor)));
B
Benjamin Pasero 已提交
733 734
		}

B
Benjamin Pasero 已提交
735
		return Promise.resolve(null);
B
Benjamin Pasero 已提交
736 737 738
	}
}

739
export class BaseMoveGroupAction extends Action {
740

741 742 743
	constructor(
		id: string,
		label: string,
B
Benjamin Pasero 已提交
744
		private direction: GroupDirection,
745
		private editorGroupService: IEditorGroupsService
746
	) {
E
Erich Gamma 已提交
747 748 749
		super(id, label);
	}

B
Benjamin Pasero 已提交
750
	run(context?: IEditorIdentifier): Promise<any> {
751
		let sourceGroup: IEditorGroup;
752 753 754 755
		if (context && typeof context.groupId === 'number') {
			sourceGroup = this.editorGroupService.getGroup(context.groupId);
		} else {
			sourceGroup = this.editorGroupService.activeGroup;
756 757
		}

B
Benjamin Pasero 已提交
758
		const targetGroup = this.findTargetGroup(sourceGroup);
759
		if (targetGroup) {
B
Benjamin Pasero 已提交
760
			this.editorGroupService.moveGroup(sourceGroup, targetGroup, this.direction);
E
Erich Gamma 已提交
761 762
		}

B
Benjamin Pasero 已提交
763
		return Promise.resolve(true);
E
Erich Gamma 已提交
764
	}
B
Benjamin Pasero 已提交
765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782

	private findTargetGroup(sourceGroup: IEditorGroup): IEditorGroup {
		const targetNeighbours: GroupDirection[] = [this.direction];

		// Allow the target group to be in alternative locations to support more
		// scenarios of moving the group to the taret location.
		// Helps for https://github.com/Microsoft/vscode/issues/50741
		switch (this.direction) {
			case GroupDirection.LEFT:
			case GroupDirection.RIGHT:
				targetNeighbours.push(GroupDirection.UP, GroupDirection.DOWN);
				break;
			case GroupDirection.UP:
			case GroupDirection.DOWN:
				targetNeighbours.push(GroupDirection.LEFT, GroupDirection.RIGHT);
				break;
		}

783 784 785 786
		for (const targetNeighbour of targetNeighbours) {
			const targetNeighbourGroup = this.editorGroupService.findGroup({ direction: targetNeighbour }, sourceGroup);
			if (targetNeighbourGroup) {
				return targetNeighbourGroup;
B
Benjamin Pasero 已提交
787 788 789
			}
		}

R
Rob Lourens 已提交
790
		return undefined;
B
Benjamin Pasero 已提交
791
	}
E
Erich Gamma 已提交
792 793
}

794 795
export class MoveGroupLeftAction extends BaseMoveGroupAction {

B
Benjamin Pasero 已提交
796 797
	static readonly ID = 'workbench.action.moveActiveEditorGroupLeft';
	static readonly LABEL = nls.localize('moveActiveGroupLeft', "Move Editor Group Left");
798 799 800 801

	constructor(
		id: string,
		label: string,
802
		@IEditorGroupsService editorGroupService: IEditorGroupsService
803
	) {
B
Benjamin Pasero 已提交
804
		super(id, label, GroupDirection.LEFT, editorGroupService);
805 806 807 808
	}
}

export class MoveGroupRightAction extends BaseMoveGroupAction {
E
Erich Gamma 已提交
809

B
Benjamin Pasero 已提交
810 811
	static readonly ID = 'workbench.action.moveActiveEditorGroupRight';
	static readonly LABEL = nls.localize('moveActiveGroupRight', "Move Editor Group Right");
812

813 814 815
	constructor(
		id: string,
		label: string,
816
		@IEditorGroupsService editorGroupService: IEditorGroupsService
817
	) {
B
Benjamin Pasero 已提交
818
		super(id, label, GroupDirection.RIGHT, editorGroupService);
819 820
	}
}
821

822
export class MoveGroupUpAction extends BaseMoveGroupAction {
823

B
Benjamin Pasero 已提交
824 825
	static readonly ID = 'workbench.action.moveActiveEditorGroupUp';
	static readonly LABEL = nls.localize('moveActiveGroupUp', "Move Editor Group Up");
E
Erich Gamma 已提交
826

827 828 829
	constructor(
		id: string,
		label: string,
830
		@IEditorGroupsService editorGroupService: IEditorGroupsService
831
	) {
B
Benjamin Pasero 已提交
832
		super(id, label, GroupDirection.UP, editorGroupService);
833 834 835 836 837
	}
}

export class MoveGroupDownAction extends BaseMoveGroupAction {

B
Benjamin Pasero 已提交
838 839
	static readonly ID = 'workbench.action.moveActiveEditorGroupDown';
	static readonly LABEL = nls.localize('moveActiveGroupDown', "Move Editor Group Down");
840 841 842 843

	constructor(
		id: string,
		label: string,
844
		@IEditorGroupsService editorGroupService: IEditorGroupsService
845
	) {
B
Benjamin Pasero 已提交
846
		super(id, label, GroupDirection.DOWN, editorGroupService);
E
Erich Gamma 已提交
847 848 849
	}
}

850
export class MinimizeOtherGroupsAction extends Action {
E
Erich Gamma 已提交
851

B
Benjamin Pasero 已提交
852 853
	static readonly ID = 'workbench.action.minimizeOtherEditors';
	static readonly LABEL = nls.localize('minimizeOtherEditorGroups', "Maximize Editor Group");
854

855
	constructor(id: string, label: string, @IEditorGroupsService private editorGroupService: IEditorGroupsService) {
E
Erich Gamma 已提交
856 857 858
		super(id, label);
	}

J
Johannes Rieken 已提交
859
	run(): Promise<any> {
860
		this.editorGroupService.arrangeGroups(GroupsArrangement.MINIMIZE_OTHERS);
E
Erich Gamma 已提交
861

B
Benjamin Pasero 已提交
862
		return Promise.resolve(false);
E
Erich Gamma 已提交
863 864 865
	}
}

B
Benjamin Pasero 已提交
866
export class ResetGroupSizesAction extends Action {
E
Erich Gamma 已提交
867

B
Benjamin Pasero 已提交
868 869
	static readonly ID = 'workbench.action.evenEditorWidths';
	static readonly LABEL = nls.localize('evenEditorGroups', "Reset Editor Group Sizes");
870

871
	constructor(id: string, label: string, @IEditorGroupsService private editorGroupService: IEditorGroupsService) {
E
Erich Gamma 已提交
872 873 874
		super(id, label);
	}

J
Johannes Rieken 已提交
875
	run(): Promise<any> {
876
		this.editorGroupService.arrangeGroups(GroupsArrangement.EVEN);
E
Erich Gamma 已提交
877

B
Benjamin Pasero 已提交
878
		return Promise.resolve(false);
E
Erich Gamma 已提交
879 880 881
	}
}

882
export class MaximizeGroupAction extends Action {
883

B
Benjamin Pasero 已提交
884 885
	static readonly ID = 'workbench.action.maximizeEditor';
	static readonly LABEL = nls.localize('maximizeEditor', "Maximize Editor Group and Hide Sidebar");
886

887 888 889
	constructor(
		id: string,
		label: string,
890 891
		@IEditorService private editorService: IEditorService,
		@IEditorGroupsService private editorGroupService: IEditorGroupsService,
892 893 894 895 896
		@IPartService private partService: IPartService
	) {
		super(id, label);
	}

J
Johannes Rieken 已提交
897
	run(): Promise<any> {
898 899
		if (this.editorService.activeEditor) {
			this.editorGroupService.arrangeGroups(GroupsArrangement.MINIMIZE_OTHERS);
900
			this.partService.setSideBarHidden(true);
901 902
		}

B
Benjamin Pasero 已提交
903
		return Promise.resolve(false);
904 905 906
	}
}

907 908
export abstract class BaseNavigateEditorAction extends Action {

909 910 911
	constructor(
		id: string,
		label: string,
912 913
		protected editorGroupService: IEditorGroupsService,
		protected editorService: IEditorService
914
	) {
915 916 917
		super(id, label);
	}

J
Johannes Rieken 已提交
918
	run(): Promise<any> {
919
		const result = this.navigate();
920
		if (!result) {
B
Benjamin Pasero 已提交
921
			return Promise.resolve(false);
922 923
		}

924 925
		const { groupId, editor } = result;
		if (!editor) {
B
Benjamin Pasero 已提交
926
			return Promise.resolve(false);
927 928 929 930
		}

		const group = this.editorGroupService.getGroup(groupId);
		return group.openEditor(editor);
931 932 933 934 935 936 937
	}

	protected abstract navigate(): IEditorIdentifier;
}

export class OpenNextEditor extends BaseNavigateEditorAction {

B
Benjamin Pasero 已提交
938 939
	static readonly ID = 'workbench.action.nextEditor';
	static readonly LABEL = nls.localize('openNextEditor', "Open Next Editor");
940

941 942 943
	constructor(
		id: string,
		label: string,
944 945
		@IEditorGroupsService editorGroupService: IEditorGroupsService,
		@IEditorService editorService: IEditorService
946 947
	) {
		super(id, label, editorGroupService, editorService);
948 949 950
	}

	protected navigate(): IEditorIdentifier {
951 952 953 954 955 956 957 958 959 960

		// Navigate in active group if possible
		const activeGroup = this.editorGroupService.activeGroup;
		const activeGroupEditors = activeGroup.getEditors(EditorsOrder.SEQUENTIAL);
		const activeEditorIndex = activeGroupEditors.indexOf(activeGroup.activeEditor);
		if (activeEditorIndex + 1 < activeGroupEditors.length) {
			return { editor: activeGroupEditors[activeEditorIndex + 1], groupId: activeGroup.id };
		}

		// Otherwise try in next group
B
Benjamin Pasero 已提交
961
		const nextGroup = this.editorGroupService.findGroup({ location: GroupLocation.NEXT }, this.editorGroupService.activeGroup, true);
962 963 964 965 966
		if (nextGroup) {
			const previousGroupEditors = nextGroup.getEditors(EditorsOrder.SEQUENTIAL);
			return { editor: previousGroupEditors[0], groupId: nextGroup.id };
		}

R
Rob Lourens 已提交
967
		return undefined;
968 969 970 971 972
	}
}

export class OpenPreviousEditor extends BaseNavigateEditorAction {

B
Benjamin Pasero 已提交
973 974
	static readonly ID = 'workbench.action.previousEditor';
	static readonly LABEL = nls.localize('openPreviousEditor', "Open Previous Editor");
975

976 977 978
	constructor(
		id: string,
		label: string,
979 980
		@IEditorGroupsService editorGroupService: IEditorGroupsService,
		@IEditorService editorService: IEditorService
981 982
	) {
		super(id, label, editorGroupService, editorService);
983 984 985
	}

	protected navigate(): IEditorIdentifier {
986 987 988 989 990 991 992 993 994 995

		// Navigate in active group if possible
		const activeGroup = this.editorGroupService.activeGroup;
		const activeGroupEditors = activeGroup.getEditors(EditorsOrder.SEQUENTIAL);
		const activeEditorIndex = activeGroupEditors.indexOf(activeGroup.activeEditor);
		if (activeEditorIndex > 0) {
			return { editor: activeGroupEditors[activeEditorIndex - 1], groupId: activeGroup.id };
		}

		// Otherwise try in previous group
B
Benjamin Pasero 已提交
996
		const previousGroup = this.editorGroupService.findGroup({ location: GroupLocation.PREVIOUS }, this.editorGroupService.activeGroup, true);
997 998 999 1000 1001
		if (previousGroup) {
			const previousGroupEditors = previousGroup.getEditors(EditorsOrder.SEQUENTIAL);
			return { editor: previousGroupEditors[previousGroupEditors.length - 1], groupId: previousGroup.id };
		}

R
Rob Lourens 已提交
1002
		return undefined;
1003 1004 1005 1006 1007
	}
}

export class OpenNextEditorInGroup extends BaseNavigateEditorAction {

B
Benjamin Pasero 已提交
1008 1009
	static readonly ID = 'workbench.action.nextEditorInGroup';
	static readonly LABEL = nls.localize('nextEditorInGroup', "Open Next Editor in Group");
1010 1011 1012 1013

	constructor(
		id: string,
		label: string,
1014 1015
		@IEditorGroupsService editorGroupService: IEditorGroupsService,
		@IEditorService editorService: IEditorService
1016 1017 1018 1019 1020
	) {
		super(id, label, editorGroupService, editorService);
	}

	protected navigate(): IEditorIdentifier {
1021 1022 1023 1024 1025
		const group = this.editorGroupService.activeGroup;
		const editors = group.getEditors(EditorsOrder.SEQUENTIAL);
		const index = editors.indexOf(group.activeEditor);

		return { editor: index + 1 < editors.length ? editors[index + 1] : editors[0], groupId: group.id };
1026 1027 1028 1029 1030
	}
}

export class OpenPreviousEditorInGroup extends BaseNavigateEditorAction {

B
Benjamin Pasero 已提交
1031 1032
	static readonly ID = 'workbench.action.previousEditorInGroup';
	static readonly LABEL = nls.localize('openPreviousEditorInGroup', "Open Previous Editor in Group");
1033 1034 1035 1036

	constructor(
		id: string,
		label: string,
1037 1038
		@IEditorGroupsService editorGroupService: IEditorGroupsService,
		@IEditorService editorService: IEditorService
1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053
	) {
		super(id, label, editorGroupService, editorService);
	}

	protected navigate(): IEditorIdentifier {
		const group = this.editorGroupService.activeGroup;
		const editors = group.getEditors(EditorsOrder.SEQUENTIAL);
		const index = editors.indexOf(group.activeEditor);

		return { editor: index > 0 ? editors[index - 1] : editors[editors.length - 1], groupId: group.id };
	}
}

export class OpenFirstEditorInGroup extends BaseNavigateEditorAction {

B
Benjamin Pasero 已提交
1054 1055
	static readonly ID = 'workbench.action.firstEditorInGroup';
	static readonly LABEL = nls.localize('firstEditorInGroup', "Open First Editor in Group");
1056 1057 1058 1059

	constructor(
		id: string,
		label: string,
1060 1061
		@IEditorGroupsService editorGroupService: IEditorGroupsService,
		@IEditorService editorService: IEditorService
1062 1063 1064 1065 1066
	) {
		super(id, label, editorGroupService, editorService);
	}

	protected navigate(): IEditorIdentifier {
1067 1068 1069 1070
		const group = this.editorGroupService.activeGroup;
		const editors = group.getEditors(EditorsOrder.SEQUENTIAL);

		return { editor: editors[0], groupId: group.id };
1071
	}
B
Benjamin Pasero 已提交
1072 1073
}

1074 1075
export class OpenLastEditorInGroup extends BaseNavigateEditorAction {

B
Benjamin Pasero 已提交
1076 1077
	static readonly ID = 'workbench.action.lastEditorInGroup';
	static readonly LABEL = nls.localize('lastEditorInGroup', "Open Last Editor in Group");
1078 1079 1080 1081

	constructor(
		id: string,
		label: string,
1082 1083
		@IEditorGroupsService editorGroupService: IEditorGroupsService,
		@IEditorService editorService: IEditorService
1084 1085 1086 1087 1088
	) {
		super(id, label, editorGroupService, editorService);
	}

	protected navigate(): IEditorIdentifier {
1089 1090 1091 1092
		const group = this.editorGroupService.activeGroup;
		const editors = group.getEditors(EditorsOrder.SEQUENTIAL);

		return { editor: editors[editors.length - 1], groupId: group.id };
1093 1094 1095
	}
}

B
Benjamin Pasero 已提交
1096 1097
export class NavigateForwardAction extends Action {

B
Benjamin Pasero 已提交
1098 1099
	static readonly ID = 'workbench.action.navigateForward';
	static readonly LABEL = nls.localize('navigateNext', "Go Forward");
B
Benjamin Pasero 已提交
1100 1101 1102 1103 1104

	constructor(id: string, label: string, @IHistoryService private historyService: IHistoryService) {
		super(id, label);
	}

J
Johannes Rieken 已提交
1105
	run(): Promise<any> {
B
Benjamin Pasero 已提交
1106 1107
		this.historyService.forward();

B
Benjamin Pasero 已提交
1108
		return Promise.resolve(null);
B
Benjamin Pasero 已提交
1109 1110 1111 1112 1113
	}
}

export class NavigateBackwardsAction extends Action {

B
Benjamin Pasero 已提交
1114 1115
	static readonly ID = 'workbench.action.navigateBack';
	static readonly LABEL = nls.localize('navigatePrevious', "Go Back");
B
Benjamin Pasero 已提交
1116 1117 1118 1119 1120

	constructor(id: string, label: string, @IHistoryService private historyService: IHistoryService) {
		super(id, label);
	}

J
Johannes Rieken 已提交
1121
	run(): Promise<any> {
B
Benjamin Pasero 已提交
1122 1123
		this.historyService.back();

B
Benjamin Pasero 已提交
1124
		return Promise.resolve(null);
B
Benjamin Pasero 已提交
1125
	}
I
isidor 已提交
1126
}
1127

1128 1129 1130 1131 1132 1133 1134 1135 1136
export class NavigateToLastEditLocationAction extends Action {

	static readonly ID = 'workbench.action.navigateToLastEditLocation';
	static readonly LABEL = nls.localize('navigateToLastEditLocation', "Go to Last Edit Location");

	constructor(id: string, label: string, @IHistoryService private historyService: IHistoryService) {
		super(id, label);
	}

J
Johannes Rieken 已提交
1137
	run(): Promise<any> {
1138 1139
		this.historyService.openLastEditLocation();

B
Benjamin Pasero 已提交
1140
		return Promise.resolve(null);
1141 1142 1143
	}
}

1144 1145
export class NavigateLastAction extends Action {

B
Benjamin Pasero 已提交
1146 1147
	static readonly ID = 'workbench.action.navigateLast';
	static readonly LABEL = nls.localize('navigateLast', "Go Last");
1148 1149 1150 1151 1152

	constructor(id: string, label: string, @IHistoryService private historyService: IHistoryService) {
		super(id, label);
	}

J
Johannes Rieken 已提交
1153
	run(): Promise<any> {
1154 1155
		this.historyService.last();

B
Benjamin Pasero 已提交
1156
		return Promise.resolve(null);
1157 1158 1159
	}
}

1160 1161
export class ReopenClosedEditorAction extends Action {

B
Benjamin Pasero 已提交
1162 1163
	static readonly ID = 'workbench.action.reopenClosedEditor';
	static readonly LABEL = nls.localize('reopenClosedEditor', "Reopen Closed Editor");
1164 1165 1166 1167

	constructor(
		id: string,
		label: string,
B
Benjamin Pasero 已提交
1168
		@IHistoryService private historyService: IHistoryService
1169 1170 1171 1172
	) {
		super(id, label);
	}

J
Johannes Rieken 已提交
1173
	run(): Promise<any> {
1174
		this.historyService.reopenLastClosedEditor();
1175

B
Benjamin Pasero 已提交
1176
		return Promise.resolve(false);
1177
	}
B
Benjamin Pasero 已提交
1178 1179
}

1180
export class ClearRecentFilesAction extends Action {
C
22768  
Cristian 已提交
1181

B
Benjamin Pasero 已提交
1182 1183
	static readonly ID = 'workbench.action.clearRecentFiles';
	static readonly LABEL = nls.localize('clearRecentFiles', "Clear Recently Opened");
C
22768  
Cristian 已提交
1184 1185 1186 1187

	constructor(
		id: string,
		label: string,
B
Benjamin Pasero 已提交
1188 1189
		@IWindowsService private windowsService: IWindowsService,
		@IHistoryService private historyService: IHistoryService
C
22768  
Cristian 已提交
1190 1191 1192 1193
	) {
		super(id, label);
	}

J
Johannes Rieken 已提交
1194
	run(): Promise<any> {
B
Benjamin Pasero 已提交
1195 1196

		// Clear global recently opened
B
Benjamin Pasero 已提交
1197
		this.windowsService.clearRecentlyOpened();
C
22768  
Cristian 已提交
1198

B
Benjamin Pasero 已提交
1199 1200 1201
		// Clear workspace specific recently opened
		this.historyService.clearRecentlyOpened();

B
Benjamin Pasero 已提交
1202
		return Promise.resolve(false);
C
22768  
Cristian 已提交
1203 1204 1205
	}
}

B
Benjamin Pasero 已提交
1206
export class ShowEditorsInActiveGroupAction extends QuickOpenAction {
B
Benjamin Pasero 已提交
1207

B
Benjamin Pasero 已提交
1208 1209
	static readonly ID = 'workbench.action.showEditorsInActiveGroup';
	static readonly LABEL = nls.localize('showEditorsInActiveGroup', "Show Editors in Active Group");
B
Benjamin Pasero 已提交
1210

1211 1212 1213
	constructor(
		actionId: string,
		actionLabel: string,
1214
		@IQuickOpenService quickOpenService: IQuickOpenService
1215
	) {
B
Benjamin Pasero 已提交
1216
		super(actionId, actionLabel, NAVIGATE_IN_ACTIVE_GROUP_PREFIX, quickOpenService);
1217
	}
B
Benjamin Pasero 已提交
1218 1219
}

B
Benjamin Pasero 已提交
1220 1221
export class ShowAllEditorsAction extends QuickOpenAction {

B
Benjamin Pasero 已提交
1222 1223
	static readonly ID = 'workbench.action.showAllEditors';
	static readonly LABEL = nls.localize('showAllEditors', "Show All Editors");
B
Benjamin Pasero 已提交
1224 1225 1226 1227 1228 1229

	constructor(actionId: string, actionLabel: string, @IQuickOpenService quickOpenService: IQuickOpenService) {
		super(actionId, actionLabel, NAVIGATE_ALL_EDITORS_GROUP_PREFIX, quickOpenService);
	}
}

1230
export class BaseQuickOpenEditorInGroupAction extends Action {
B
Benjamin Pasero 已提交
1231 1232 1233 1234 1235

	constructor(
		id: string,
		label: string,
		@IQuickOpenService private quickOpenService: IQuickOpenService,
B
Benjamin Pasero 已提交
1236
		@IKeybindingService private keybindingService: IKeybindingService
B
Benjamin Pasero 已提交
1237 1238 1239 1240
	) {
		super(id, label);
	}

J
Johannes Rieken 已提交
1241
	run(): Promise<any> {
1242
		const keys = this.keybindingService.lookupKeybindings(this.id);
B
Benjamin Pasero 已提交
1243

1244

B
Benjamin Pasero 已提交
1245 1246

		this.quickOpenService.show(NAVIGATE_IN_ACTIVE_GROUP_PREFIX, { quickNavigateConfiguration: { keybindings: keys } });
B
Benjamin Pasero 已提交
1247

B
Benjamin Pasero 已提交
1248
		return Promise.resolve(true);
B
Benjamin Pasero 已提交
1249 1250 1251
	}
}

1252 1253
export class OpenPreviousRecentlyUsedEditorInGroupAction extends BaseQuickOpenEditorInGroupAction {

B
Benjamin Pasero 已提交
1254 1255
	static readonly ID = 'workbench.action.openPreviousRecentlyUsedEditorInGroup';
	static readonly LABEL = nls.localize('openPreviousRecentlyUsedEditorInGroup', "Open Previous Recently Used Editor in Group");
1256 1257 1258 1259 1260

	constructor(
		id: string,
		label: string,
		@IQuickOpenService quickOpenService: IQuickOpenService,
B
Benjamin Pasero 已提交
1261
		@IKeybindingService keybindingService: IKeybindingService
1262
	) {
B
Benjamin Pasero 已提交
1263
		super(id, label, quickOpenService, keybindingService);
1264 1265 1266 1267 1268
	}
}

export class OpenNextRecentlyUsedEditorInGroupAction extends BaseQuickOpenEditorInGroupAction {

B
Benjamin Pasero 已提交
1269 1270
	static readonly ID = 'workbench.action.openNextRecentlyUsedEditorInGroup';
	static readonly LABEL = nls.localize('openNextRecentlyUsedEditorInGroup', "Open Next Recently Used Editor in Group");
1271 1272 1273 1274 1275

	constructor(
		id: string,
		label: string,
		@IQuickOpenService quickOpenService: IQuickOpenService,
B
Benjamin Pasero 已提交
1276
		@IKeybindingService keybindingService: IKeybindingService
1277
	) {
B
Benjamin Pasero 已提交
1278
		super(id, label, quickOpenService, keybindingService);
1279 1280 1281
	}
}

1282
export class OpenPreviousEditorFromHistoryAction extends Action {
B
Benjamin Pasero 已提交
1283

B
Benjamin Pasero 已提交
1284 1285
	static readonly ID = 'workbench.action.openPreviousEditorFromHistory';
	static readonly LABEL = nls.localize('navigateEditorHistoryByInput', "Open Previous Editor from History");
B
Benjamin Pasero 已提交
1286 1287 1288 1289 1290 1291 1292 1293 1294 1295

	constructor(
		id: string,
		label: string,
		@IQuickOpenService private quickOpenService: IQuickOpenService,
		@IKeybindingService private keybindingService: IKeybindingService
	) {
		super(id, label);
	}

J
Johannes Rieken 已提交
1296
	run(): Promise<any> {
1297
		const keys = this.keybindingService.lookupKeybindings(this.id);
B
Benjamin Pasero 已提交
1298

B
Benjamin Pasero 已提交
1299
		this.quickOpenService.show(null, { quickNavigateConfiguration: { keybindings: keys } });
B
Benjamin Pasero 已提交
1300

B
Benjamin Pasero 已提交
1301
		return Promise.resolve(true);
B
Benjamin Pasero 已提交
1302 1303 1304
	}
}

1305 1306
export class OpenNextRecentlyUsedEditorAction extends Action {

B
Benjamin Pasero 已提交
1307 1308
	static readonly ID = 'workbench.action.openNextRecentlyUsedEditor';
	static readonly LABEL = nls.localize('openNextRecentlyUsedEditor', "Open Next Recently Used Editor");
1309 1310 1311 1312 1313

	constructor(id: string, label: string, @IHistoryService private historyService: IHistoryService) {
		super(id, label);
	}

J
Johannes Rieken 已提交
1314
	run(): Promise<any> {
1315 1316
		this.historyService.forward(true);

B
Benjamin Pasero 已提交
1317
		return Promise.resolve(null);
1318 1319 1320 1321 1322
	}
}

export class OpenPreviousRecentlyUsedEditorAction extends Action {

B
Benjamin Pasero 已提交
1323 1324
	static readonly ID = 'workbench.action.openPreviousRecentlyUsedEditor';
	static readonly LABEL = nls.localize('openPreviousRecentlyUsedEditor', "Open Previous Recently Used Editor");
1325 1326 1327 1328 1329

	constructor(id: string, label: string, @IHistoryService private historyService: IHistoryService) {
		super(id, label);
	}

J
Johannes Rieken 已提交
1330
	run(): Promise<any> {
1331 1332
		this.historyService.back(true);

B
Benjamin Pasero 已提交
1333
		return Promise.resolve(null);
1334 1335 1336
	}
}

1337 1338
export class ClearEditorHistoryAction extends Action {

B
Benjamin Pasero 已提交
1339 1340
	static readonly ID = 'workbench.action.clearEditorHistory';
	static readonly LABEL = nls.localize('clearEditorHistory', "Clear Editor History");
1341 1342 1343 1344 1345 1346 1347 1348 1349

	constructor(
		id: string,
		label: string,
		@IHistoryService private historyService: IHistoryService
	) {
		super(id, label);
	}

J
Johannes Rieken 已提交
1350
	run(): Promise<any> {
1351

1352
		// Editor history
1353 1354
		this.historyService.clear();

B
Benjamin Pasero 已提交
1355
		return Promise.resolve(true);
1356 1357 1358
	}
}

1359
export class MoveEditorLeftInGroupAction extends ExecuteCommandAction {
1360

B
Benjamin Pasero 已提交
1361 1362
	static readonly ID = 'workbench.action.moveEditorLeftInGroup';
	static readonly LABEL = nls.localize('moveEditorLeft', "Move Editor Left");
1363 1364 1365 1366

	constructor(
		id: string,
		label: string,
1367
		@ICommandService commandService: ICommandService
1368
	) {
1369
		super(id, label, MOVE_ACTIVE_EDITOR_COMMAND_ID, commandService, { to: 'left' } as ActiveEditorMoveArguments);
1370 1371 1372
	}
}

1373
export class MoveEditorRightInGroupAction extends ExecuteCommandAction {
1374

B
Benjamin Pasero 已提交
1375 1376
	static readonly ID = 'workbench.action.moveEditorRightInGroup';
	static readonly LABEL = nls.localize('moveEditorRight', "Move Editor Right");
1377 1378 1379 1380

	constructor(
		id: string,
		label: string,
1381
		@ICommandService commandService: ICommandService
1382
	) {
1383
		super(id, label, MOVE_ACTIVE_EDITOR_COMMAND_ID, commandService, { to: 'right' } as ActiveEditorMoveArguments);
1384 1385 1386
	}
}

1387
export class MoveEditorToPreviousGroupAction extends ExecuteCommandAction {
1388

B
Benjamin Pasero 已提交
1389 1390
	static readonly ID = 'workbench.action.moveEditorToPreviousGroup';
	static readonly LABEL = nls.localize('moveEditorToPreviousGroup', "Move Editor into Previous Group");
1391 1392 1393 1394

	constructor(
		id: string,
		label: string,
1395
		@ICommandService commandService: ICommandService
1396
	) {
1397
		super(id, label, MOVE_ACTIVE_EDITOR_COMMAND_ID, commandService, { to: 'previous', by: 'group' } as ActiveEditorMoveArguments);
1398
	}
1399
}
1400

1401
export class MoveEditorToNextGroupAction extends ExecuteCommandAction {
1402

B
Benjamin Pasero 已提交
1403 1404
	static readonly ID = 'workbench.action.moveEditorToNextGroup';
	static readonly LABEL = nls.localize('moveEditorToNextGroup', "Move Editor into Next Group");
1405 1406 1407 1408 1409 1410 1411

	constructor(
		id: string,
		label: string,
		@ICommandService commandService: ICommandService
	) {
		super(id, label, MOVE_ACTIVE_EDITOR_COMMAND_ID, commandService, { to: 'next', by: 'group' } as ActiveEditorMoveArguments);
1412 1413 1414
	}
}

1415
export class MoveEditorToAboveGroupAction extends ExecuteCommandAction {
1416

B
Benjamin Pasero 已提交
1417 1418
	static readonly ID = 'workbench.action.moveEditorToAboveGroup';
	static readonly LABEL = nls.localize('moveEditorToAboveGroup', "Move Editor into Above Group");
1419 1420 1421 1422

	constructor(
		id: string,
		label: string,
1423
		@ICommandService commandService: ICommandService
1424
	) {
1425
		super(id, label, MOVE_ACTIVE_EDITOR_COMMAND_ID, commandService, { to: 'up', by: 'group' } as ActiveEditorMoveArguments);
1426
	}
1427
}
1428

1429
export class MoveEditorToBelowGroupAction extends ExecuteCommandAction {
1430

B
Benjamin Pasero 已提交
1431 1432
	static readonly ID = 'workbench.action.moveEditorToBelowGroup';
	static readonly LABEL = nls.localize('moveEditorToBelowGroup', "Move Editor into Below Group");
1433 1434 1435 1436 1437 1438 1439

	constructor(
		id: string,
		label: string,
		@ICommandService commandService: ICommandService
	) {
		super(id, label, MOVE_ACTIVE_EDITOR_COMMAND_ID, commandService, { to: 'down', by: 'group' } as ActiveEditorMoveArguments);
1440 1441 1442
	}
}

1443
export class MoveEditorToLeftGroupAction extends ExecuteCommandAction {
1444

B
Benjamin Pasero 已提交
1445 1446
	static readonly ID = 'workbench.action.moveEditorToLeftGroup';
	static readonly LABEL = nls.localize('moveEditorToLeftGroup', "Move Editor into Left Group");
1447 1448 1449 1450

	constructor(
		id: string,
		label: string,
1451
		@ICommandService commandService: ICommandService
1452
	) {
1453
		super(id, label, MOVE_ACTIVE_EDITOR_COMMAND_ID, commandService, { to: 'left', by: 'group' } as ActiveEditorMoveArguments);
1454
	}
1455
}
1456

1457
export class MoveEditorToRightGroupAction extends ExecuteCommandAction {
1458

B
Benjamin Pasero 已提交
1459 1460
	static readonly ID = 'workbench.action.moveEditorToRightGroup';
	static readonly LABEL = nls.localize('moveEditorToRightGroup', "Move Editor into Right Group");
1461 1462 1463 1464 1465 1466 1467

	constructor(
		id: string,
		label: string,
		@ICommandService commandService: ICommandService
	) {
		super(id, label, MOVE_ACTIVE_EDITOR_COMMAND_ID, commandService, { to: 'right', by: 'group' } as ActiveEditorMoveArguments);
1468 1469 1470
	}
}

1471
export class MoveEditorToFirstGroupAction extends ExecuteCommandAction {
1472

B
Benjamin Pasero 已提交
1473 1474
	static readonly ID = 'workbench.action.moveEditorToFirstGroup';
	static readonly LABEL = nls.localize('moveEditorToFirstGroup', "Move Editor into First Group");
1475 1476 1477 1478

	constructor(
		id: string,
		label: string,
1479
		@ICommandService commandService: ICommandService
1480
	) {
1481
		super(id, label, MOVE_ACTIVE_EDITOR_COMMAND_ID, commandService, { to: 'first', by: 'group' } as ActiveEditorMoveArguments);
1482
	}
1483
}
1484

1485
export class MoveEditorToLastGroupAction extends ExecuteCommandAction {
1486

B
Benjamin Pasero 已提交
1487 1488
	static readonly ID = 'workbench.action.moveEditorToLastGroup';
	static readonly LABEL = nls.localize('moveEditorToLastGroup', "Move Editor into Last Group");
1489 1490 1491 1492 1493 1494 1495

	constructor(
		id: string,
		label: string,
		@ICommandService commandService: ICommandService
	) {
		super(id, label, MOVE_ACTIVE_EDITOR_COMMAND_ID, commandService, { to: 'last', by: 'group' } as ActiveEditorMoveArguments);
1496 1497 1498
	}
}

1499
export class EditorLayoutSingleAction extends ExecuteCommandAction {
1500

B
Benjamin Pasero 已提交
1501 1502
	static readonly ID = 'workbench.action.editorLayoutSingle';
	static readonly LABEL = nls.localize('editorLayoutSingle', "Single Column Editor Layout");
1503 1504 1505 1506

	constructor(
		id: string,
		label: string,
1507
		@ICommandService commandService: ICommandService
1508
	) {
1509
		super(id, label, LAYOUT_EDITOR_GROUPS_COMMAND_ID, commandService, { groups: [{}] } as EditorGroupLayout);
1510
	}
1511
}
1512

1513
export class EditorLayoutTwoColumnsAction extends ExecuteCommandAction {
1514

B
Benjamin Pasero 已提交
1515 1516
	static readonly ID = 'workbench.action.editorLayoutTwoColumns';
	static readonly LABEL = nls.localize('editorLayoutTwoColumns', "Two Columns Editor Layout");
1517 1518 1519 1520 1521 1522 1523

	constructor(
		id: string,
		label: string,
		@ICommandService commandService: ICommandService
	) {
		super(id, label, LAYOUT_EDITOR_GROUPS_COMMAND_ID, commandService, { groups: [{}, {}], orientation: GroupOrientation.HORIZONTAL } as EditorGroupLayout);
1524 1525 1526
	}
}

1527
export class EditorLayoutThreeColumnsAction extends ExecuteCommandAction {
1528

B
Benjamin Pasero 已提交
1529 1530
	static readonly ID = 'workbench.action.editorLayoutThreeColumns';
	static readonly LABEL = nls.localize('editorLayoutThreeColumns', "Three Columns Editor Layout");
1531 1532 1533 1534

	constructor(
		id: string,
		label: string,
1535
		@ICommandService commandService: ICommandService
1536
	) {
1537 1538 1539 1540 1541 1542
		super(id, label, LAYOUT_EDITOR_GROUPS_COMMAND_ID, commandService, { groups: [{}, {}, {}], orientation: GroupOrientation.HORIZONTAL } as EditorGroupLayout);
	}
}

export class EditorLayoutTwoRowsAction extends ExecuteCommandAction {

B
Benjamin Pasero 已提交
1543 1544
	static readonly ID = 'workbench.action.editorLayoutTwoRows';
	static readonly LABEL = nls.localize('editorLayoutTwoRows', "Two Rows Editor Layout");
1545 1546 1547 1548 1549 1550 1551

	constructor(
		id: string,
		label: string,
		@ICommandService commandService: ICommandService
	) {
		super(id, label, LAYOUT_EDITOR_GROUPS_COMMAND_ID, commandService, { groups: [{}, {}], orientation: GroupOrientation.VERTICAL } as EditorGroupLayout);
1552
	}
1553
}
1554

1555
export class EditorLayoutThreeRowsAction extends ExecuteCommandAction {
1556

B
Benjamin Pasero 已提交
1557 1558
	static readonly ID = 'workbench.action.editorLayoutThreeRows';
	static readonly LABEL = nls.localize('editorLayoutThreeRows', "Three Rows Editor Layout");
1559 1560 1561 1562 1563 1564 1565

	constructor(
		id: string,
		label: string,
		@ICommandService commandService: ICommandService
	) {
		super(id, label, LAYOUT_EDITOR_GROUPS_COMMAND_ID, commandService, { groups: [{}, {}, {}], orientation: GroupOrientation.VERTICAL } as EditorGroupLayout);
1566
	}
D
Daniel Imms 已提交
1567
}
1568

1569
export class EditorLayoutTwoByTwoGridAction extends ExecuteCommandAction {
1570

B
Benjamin Pasero 已提交
1571 1572
	static readonly ID = 'workbench.action.editorLayoutTwoByTwoGrid';
	static readonly LABEL = nls.localize('editorLayoutTwoByTwoGrid', "Grid Editor Layout (2x2)");
1573 1574 1575 1576

	constructor(
		id: string,
		label: string,
1577
		@ICommandService commandService: ICommandService
1578
	) {
1579
		super(id, label, LAYOUT_EDITOR_GROUPS_COMMAND_ID, commandService, { groups: [{ groups: [{}, {}] }, { groups: [{}, {}] }] } as EditorGroupLayout);
1580
	}
1581
}
1582

B
Benjamin Pasero 已提交
1583
export class EditorLayoutTwoColumnsBottomAction extends ExecuteCommandAction {
1584

B
Benjamin Pasero 已提交
1585 1586
	static readonly ID = 'workbench.action.editorLayoutTwoColumnsBottom';
	static readonly LABEL = nls.localize('editorLayoutTwoColumnsBottom', "Two Columns Bottom Editor Layout");
1587 1588 1589 1590 1591 1592

	constructor(
		id: string,
		label: string,
		@ICommandService commandService: ICommandService
	) {
B
Benjamin Pasero 已提交
1593
		super(id, label, LAYOUT_EDITOR_GROUPS_COMMAND_ID, commandService, { groups: [{}, { groups: [{}, {}] }], orientation: GroupOrientation.VERTICAL } as EditorGroupLayout);
1594 1595 1596
	}
}

B
Benjamin Pasero 已提交
1597
export class EditorLayoutTwoRowsRightAction extends ExecuteCommandAction {
1598

B
Benjamin Pasero 已提交
1599 1600
	static readonly ID = 'workbench.action.editorLayoutTwoRowsRight';
	static readonly LABEL = nls.localize('editorLayoutTwoRowsRight', "Two Rows Right Editor Layout");
1601 1602 1603 1604

	constructor(
		id: string,
		label: string,
1605
		@ICommandService commandService: ICommandService
1606
	) {
B
Benjamin Pasero 已提交
1607
		super(id, label, LAYOUT_EDITOR_GROUPS_COMMAND_ID, commandService, { groups: [{}, { groups: [{}, {}] }], orientation: GroupOrientation.HORIZONTAL } as EditorGroupLayout);
1608
	}
1609
}
1610

1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621
export class BaseCreateEditorGroupAction extends Action {

	constructor(
		id: string,
		label: string,
		private direction: GroupDirection,
		private editorGroupService: IEditorGroupsService
	) {
		super(id, label);
	}

J
Johannes Rieken 已提交
1622
	run(): Promise<any> {
1623 1624
		this.editorGroupService.addGroup(this.editorGroupService.activeGroup, this.direction, { activate: true });

B
Benjamin Pasero 已提交
1625
		return Promise.resolve(true);
1626 1627 1628 1629 1630
	}
}

export class NewEditorGroupLeftAction extends BaseCreateEditorGroupAction {

B
Benjamin Pasero 已提交
1631 1632
	static readonly ID = 'workbench.action.newGroupLeft';
	static readonly LABEL = nls.localize('newEditorLeft', "New Editor Group to the Left");
1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644

	constructor(
		id: string,
		label: string,
		@IEditorGroupsService editorGroupService: IEditorGroupsService
	) {
		super(id, label, GroupDirection.LEFT, editorGroupService);
	}
}

export class NewEditorGroupRightAction extends BaseCreateEditorGroupAction {

B
Benjamin Pasero 已提交
1645 1646
	static readonly ID = 'workbench.action.newGroupRight';
	static readonly LABEL = nls.localize('newEditorRight', "New Editor Group to the Right");
1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658

	constructor(
		id: string,
		label: string,
		@IEditorGroupsService editorGroupService: IEditorGroupsService
	) {
		super(id, label, GroupDirection.RIGHT, editorGroupService);
	}
}

export class NewEditorGroupAboveAction extends BaseCreateEditorGroupAction {

B
Benjamin Pasero 已提交
1659 1660
	static readonly ID = 'workbench.action.newGroupAbove';
	static readonly LABEL = nls.localize('newEditorAbove', "New Editor Group Above");
1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672

	constructor(
		id: string,
		label: string,
		@IEditorGroupsService editorGroupService: IEditorGroupsService
	) {
		super(id, label, GroupDirection.UP, editorGroupService);
	}
}

export class NewEditorGroupBelowAction extends BaseCreateEditorGroupAction {

B
Benjamin Pasero 已提交
1673 1674
	static readonly ID = 'workbench.action.newGroupBelow';
	static readonly LABEL = nls.localize('newEditorBelow', "New Editor Group Below");
1675 1676 1677 1678 1679 1680 1681 1682

	constructor(
		id: string,
		label: string,
		@IEditorGroupsService editorGroupService: IEditorGroupsService
	) {
		super(id, label, GroupDirection.DOWN, editorGroupService);
	}
I
isidor 已提交
1683
}