mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-09 19:34:34 +01:00
grid - first cut nexteditor => editor
This commit is contained in:
@@ -21,7 +21,7 @@ import { NotificationsCenter } from 'vs/workbench/browser/parts/notifications/no
|
||||
import { NotificationsToasts } from 'vs/workbench/browser/parts/notifications/notificationsToasts';
|
||||
import { Dimension, getClientArea, size, position, hide, show } from 'vs/base/browser/dom';
|
||||
import { INextEditorGroupsService } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { NextEditorPart } from 'vs/workbench/browser/parts/editor/nextEditorPart';
|
||||
import { EditorPart } from 'vs/workbench/browser/parts/editor/editorPart';
|
||||
import { TitlebarPart } from 'vs/workbench/browser/parts/titlebar/titlebarPart';
|
||||
import { ActivitybarPart } from 'vs/workbench/browser/parts/activitybar/activitybarPart';
|
||||
import { SidebarPart } from 'vs/workbench/browser/parts/sidebar/sidebarPart';
|
||||
@@ -76,7 +76,7 @@ export class WorkbenchLayout extends Disposable implements IVerticalSashLayoutPr
|
||||
private parts: {
|
||||
titlebar: TitlebarPart,
|
||||
activitybar: ActivitybarPart,
|
||||
editor: NextEditorPart,
|
||||
editor: EditorPart,
|
||||
sidebar: SidebarPart,
|
||||
panel: PanelPart,
|
||||
statusbar: StatusbarPart
|
||||
|
||||
@@ -10,7 +10,7 @@ import { EditorInput, EditorOptions, IEditor } from 'vs/workbench/common/editor'
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { INextEditorGroup } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { IEditorGroup } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
|
||||
/**
|
||||
* The base class of editors in the workbench. Editors register themselves for specific editor inputs.
|
||||
@@ -30,7 +30,7 @@ export abstract class BaseEditor extends Panel implements IEditor {
|
||||
protected _input: EditorInput;
|
||||
|
||||
private _options: EditorOptions;
|
||||
private _group: INextEditorGroup;
|
||||
private _group: IEditorGroup;
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -48,7 +48,7 @@ export abstract class BaseEditor extends Panel implements IEditor {
|
||||
return this._options;
|
||||
}
|
||||
|
||||
get group(): INextEditorGroup {
|
||||
get group(): IEditorGroup {
|
||||
return this._group;
|
||||
}
|
||||
|
||||
@@ -106,9 +106,9 @@ export abstract class BaseEditor extends Panel implements IEditor {
|
||||
*/
|
||||
protected abstract createEditor(parent: HTMLElement): void;
|
||||
|
||||
setVisible(visible: boolean, group?: INextEditorGroup): void; // setVisible is sync for editors
|
||||
setVisible(visible: boolean, group?: INextEditorGroup): TPromise<void>;
|
||||
setVisible(visible: boolean, group?: INextEditorGroup): TPromise<void> {
|
||||
setVisible(visible: boolean, group?: IEditorGroup): void; // setVisible is sync for editors
|
||||
setVisible(visible: boolean, group?: IEditorGroup): TPromise<void>;
|
||||
setVisible(visible: boolean, group?: IEditorGroup): TPromise<void> {
|
||||
const promise = super.setVisible(visible);
|
||||
|
||||
// Propagate to Editor
|
||||
@@ -124,7 +124,7 @@ export abstract class BaseEditor extends Panel implements IEditor {
|
||||
* @param visible the state of visibility of this editor
|
||||
* @param group the editor group this editor is in.
|
||||
*/
|
||||
protected setEditorVisible(visible: boolean, group: INextEditorGroup): void {
|
||||
protected setEditorVisible(visible: boolean, group: IEditorGroup): void {
|
||||
this._group = group;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { GroupIdentifier, IWorkbenchEditorConfiguration, IWorkbenchEditorPartConfiguration, EditorOptions, TextEditorOptions, IEditorInput } from 'vs/workbench/common/editor';
|
||||
import { EditorGroup } from 'vs/workbench/common/editor/editorGroup';
|
||||
import { INextEditorGroup, GroupDirection, IAddGroupOptions, IMergeGroupOptions } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { IEditorGroup, GroupDirection, IAddGroupOptions, IMergeGroupOptions } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { Dimension } from 'vs/base/browser/dom';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
@@ -22,11 +22,11 @@ export const EDITOR_TITLE_HEIGHT = 35;
|
||||
export const EDITOR_MIN_DIMENSIONS = new Dimension(220, 70);
|
||||
export const EDITOR_MAX_DIMENSIONS = new Dimension(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY);
|
||||
|
||||
export interface INextEditorPartOptions extends IWorkbenchEditorPartConfiguration {
|
||||
export interface IEditorPartOptions extends IWorkbenchEditorPartConfiguration {
|
||||
iconTheme?: string;
|
||||
}
|
||||
|
||||
export const DEFAULT_EDITOR_PART_OPTIONS: INextEditorPartOptions = {
|
||||
export const DEFAULT_EDITOR_PART_OPTIONS: IEditorPartOptions = {
|
||||
showTabs: true,
|
||||
tabCloseButton: 'right',
|
||||
tabSizing: 'fit',
|
||||
@@ -41,8 +41,8 @@ export function impactsEditorPartOptions(event: IConfigurationChangeEvent): bool
|
||||
return event.affectsConfiguration('workbench.editor') || event.affectsConfiguration('workbench.iconTheme');
|
||||
}
|
||||
|
||||
export function getEditorPartOptions(config: IWorkbenchEditorConfiguration): INextEditorPartOptions {
|
||||
const options: INextEditorPartOptions = assign(Object.create(null), DEFAULT_EDITOR_PART_OPTIONS);
|
||||
export function getEditorPartOptions(config: IWorkbenchEditorConfiguration): IEditorPartOptions {
|
||||
const options: IEditorPartOptions = assign(Object.create(null), DEFAULT_EDITOR_PART_OPTIONS);
|
||||
|
||||
if (!config || !config.workbench) {
|
||||
return options;
|
||||
@@ -59,33 +59,33 @@ export function getEditorPartOptions(config: IWorkbenchEditorConfiguration): INe
|
||||
return options;
|
||||
}
|
||||
|
||||
export interface INextEditorPartOptionsChangeEvent {
|
||||
oldPartOptions: INextEditorPartOptions;
|
||||
newPartOptions: INextEditorPartOptions;
|
||||
export interface IEditorPartOptionsChangeEvent {
|
||||
oldPartOptions: IEditorPartOptions;
|
||||
newPartOptions: IEditorPartOptions;
|
||||
}
|
||||
|
||||
export interface INextEditorGroupsAccessor {
|
||||
readonly groups: INextEditorGroupView[];
|
||||
readonly activeGroup: INextEditorGroupView;
|
||||
export interface IEditorGroupsAccessor {
|
||||
readonly groups: IEditorGroupView[];
|
||||
readonly activeGroup: IEditorGroupView;
|
||||
|
||||
readonly partOptions: INextEditorPartOptions;
|
||||
readonly onDidEditorPartOptionsChange: Event<INextEditorPartOptionsChangeEvent>;
|
||||
readonly partOptions: IEditorPartOptions;
|
||||
readonly onDidEditorPartOptionsChange: Event<IEditorPartOptionsChangeEvent>;
|
||||
|
||||
getGroup(identifier: GroupIdentifier): INextEditorGroupView;
|
||||
getGroup(identifier: GroupIdentifier): IEditorGroupView;
|
||||
|
||||
activateGroup(identifier: INextEditorGroupView | GroupIdentifier): INextEditorGroupView;
|
||||
focusGroup(identifier: INextEditorGroupView | GroupIdentifier): INextEditorGroupView;
|
||||
activateGroup(identifier: IEditorGroupView | GroupIdentifier): IEditorGroupView;
|
||||
focusGroup(identifier: IEditorGroupView | GroupIdentifier): IEditorGroupView;
|
||||
|
||||
addGroup(location: INextEditorGroupView | GroupIdentifier, direction: GroupDirection, options?: IAddGroupOptions): INextEditorGroupView;
|
||||
mergeGroup(group: INextEditorGroupView | GroupIdentifier, target: INextEditorGroupView | GroupIdentifier, options?: IMergeGroupOptions): INextEditorGroupView;
|
||||
addGroup(location: IEditorGroupView | GroupIdentifier, direction: GroupDirection, options?: IAddGroupOptions): IEditorGroupView;
|
||||
mergeGroup(group: IEditorGroupView | GroupIdentifier, target: IEditorGroupView | GroupIdentifier, options?: IMergeGroupOptions): IEditorGroupView;
|
||||
|
||||
moveGroup(group: INextEditorGroupView | GroupIdentifier, location: INextEditorGroupView | GroupIdentifier, direction: GroupDirection): INextEditorGroupView;
|
||||
copyGroup(group: INextEditorGroupView | GroupIdentifier, location: INextEditorGroupView | GroupIdentifier, direction: GroupDirection): INextEditorGroupView;
|
||||
moveGroup(group: IEditorGroupView | GroupIdentifier, location: IEditorGroupView | GroupIdentifier, direction: GroupDirection): IEditorGroupView;
|
||||
copyGroup(group: IEditorGroupView | GroupIdentifier, location: IEditorGroupView | GroupIdentifier, direction: GroupDirection): IEditorGroupView;
|
||||
|
||||
removeGroup(group: INextEditorGroupView | GroupIdentifier): void;
|
||||
removeGroup(group: IEditorGroupView | GroupIdentifier): void;
|
||||
}
|
||||
|
||||
export interface INextEditorGroupView extends IDisposable, ISerializableView, INextEditorGroup {
|
||||
export interface IEditorGroupView extends IDisposable, ISerializableView, IEditorGroup {
|
||||
readonly group: EditorGroup;
|
||||
readonly whenRestored: TPromise<void>;
|
||||
readonly disposed: boolean;
|
||||
@@ -100,7 +100,7 @@ export interface INextEditorGroupView extends IDisposable, ISerializableView, IN
|
||||
shutdown(): void;
|
||||
}
|
||||
|
||||
export function getActiveTextEditorOptions(group: INextEditorGroup, expectedActiveEditor?: IEditorInput, presetOptions?: EditorOptions): EditorOptions {
|
||||
export function getActiveTextEditorOptions(group: IEditorGroup, expectedActiveEditor?: IEditorInput, presetOptions?: EditorOptions): EditorOptions {
|
||||
const activeGroupCodeEditor = group.activeControl ? getCodeEditor(group.activeControl.getControl()) : void 0;
|
||||
if (activeGroupCodeEditor) {
|
||||
if (!expectedActiveEditor || expectedActiveEditor.matches(group.activeEditor)) {
|
||||
|
||||
@@ -20,7 +20,7 @@ import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import { IWindowsService } from 'vs/platform/windows/common/windows';
|
||||
import { CLOSE_EDITOR_COMMAND_ID, NAVIGATE_ALL_EDITORS_GROUP_PREFIX, MOVE_ACTIVE_EDITOR_COMMAND_ID, NAVIGATE_IN_ACTIVE_GROUP_PREFIX, ActiveEditorMoveArguments } from 'vs/workbench/browser/parts/editor/editorCommands';
|
||||
import { INextEditorGroupsService, INextEditorGroup, GroupsArrangement, EditorsOrder, GroupLocation, GroupDirection, preferredGroupDirection } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { INextEditorGroupsService, IEditorGroup, GroupsArrangement, EditorsOrder, GroupLocation, GroupDirection, preferredGroupDirection } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { INextEditorService, SIDE_GROUP } from 'vs/workbench/services/editor/common/nextEditorService';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
|
||||
@@ -37,7 +37,7 @@ export class BaseSplitEditorGroupAction extends Action {
|
||||
}
|
||||
|
||||
public run(context?: IEditorIdentifier): TPromise<any> {
|
||||
let sourceGroup: INextEditorGroup;
|
||||
let sourceGroup: IEditorGroup;
|
||||
if (context && typeof context.groupId === 'number') {
|
||||
sourceGroup = this.editorGroupService.getGroup(context.groupId);
|
||||
} else {
|
||||
@@ -173,7 +173,7 @@ export class JoinTwoGroupsAction extends Action {
|
||||
}
|
||||
|
||||
public run(context?: IEditorIdentifier): TPromise<any> {
|
||||
let sourceGroup: INextEditorGroup;
|
||||
let sourceGroup: IEditorGroup;
|
||||
if (context && typeof context.groupId === 'number') {
|
||||
sourceGroup = this.editorGroupService.getGroup(context.groupId);
|
||||
} else {
|
||||
@@ -413,7 +413,7 @@ export class CloseOneEditorAction extends Action {
|
||||
}
|
||||
|
||||
public run(context?: IEditorCommandsContext): TPromise<any> {
|
||||
let group: INextEditorGroup;
|
||||
let group: IEditorGroup;
|
||||
let editorIndex: number;
|
||||
if (context) {
|
||||
group = this.editorGroupService.getGroup(context.groupId);
|
||||
@@ -501,7 +501,7 @@ export class CloseLeftEditorsInGroupAction extends Action {
|
||||
}
|
||||
}
|
||||
|
||||
function getTarget(editorService: INextEditorService, editorGroupService: INextEditorGroupsService, context?: IEditorIdentifier): { editor: IEditorInput, group: INextEditorGroup } {
|
||||
function getTarget(editorService: INextEditorService, editorGroupService: INextEditorGroupsService, context?: IEditorIdentifier): { editor: IEditorInput, group: IEditorGroup } {
|
||||
if (context) {
|
||||
return { editor: context.editor, group: editorGroupService.getGroup(context.groupId) };
|
||||
}
|
||||
@@ -592,7 +592,7 @@ export class BaseMoveGroupAction extends Action {
|
||||
}
|
||||
|
||||
public run(context?: IEditorIdentifier): TPromise<any> {
|
||||
let sourceGroup: INextEditorGroup;
|
||||
let sourceGroup: IEditorGroup;
|
||||
if (context && typeof context.groupId === 'number') {
|
||||
sourceGroup = this.editorGroupService.getGroup(context.groupId);
|
||||
} else {
|
||||
|
||||
@@ -20,7 +20,7 @@ import { IDiffEditorOptions } from 'vs/editor/common/config/editorOptions';
|
||||
import { IListService } from 'vs/platform/list/browser/listService';
|
||||
import { List } from 'vs/base/browser/ui/list/listWidget';
|
||||
import { distinct } from 'vs/base/common/arrays';
|
||||
import { INextEditorGroupsService, INextEditorGroup, GroupDirection, GroupLocation, GroupsOrder, preferredGroupDirection } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { INextEditorGroupsService, IEditorGroup, GroupDirection, GroupLocation, GroupsOrder, preferredGroupDirection } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
|
||||
@@ -133,7 +133,7 @@ function moveActiveEditorToGroup(args: ActiveEditorMoveArguments, control: IEdit
|
||||
|
||||
const groups = editorGroupService.groups;
|
||||
const sourceGroup = control.group;
|
||||
let targetGroup: INextEditorGroup;
|
||||
let targetGroup: IEditorGroup;
|
||||
|
||||
switch (args.to) {
|
||||
case 'left':
|
||||
@@ -425,7 +425,7 @@ function registerEditorCommands() {
|
||||
handler: (accessor, resource: URI | object, context: IEditorCommandsContext) => {
|
||||
const editorGroupService = accessor.get(INextEditorGroupsService);
|
||||
|
||||
let group: INextEditorGroup;
|
||||
let group: IEditorGroup;
|
||||
if (context && typeof context.groupId === 'number') {
|
||||
group = editorGroupService.getGroup(context.groupId);
|
||||
} else {
|
||||
@@ -522,7 +522,7 @@ function registerEditorCommands() {
|
||||
});
|
||||
}
|
||||
|
||||
function resolveCommandsContext(editorGroupService: INextEditorGroupsService, context?: IEditorCommandsContext): { group: INextEditorGroup, editor: IEditorInput, control: IEditor } {
|
||||
function resolveCommandsContext(editorGroupService: INextEditorGroupsService, context?: IEditorCommandsContext): { group: IEditorGroup, editor: IEditorInput, control: IEditor } {
|
||||
|
||||
// Resolve from context
|
||||
let group = context && typeof context.groupId === 'number' ? editorGroupService.getGroup(context.groupId) : undefined;
|
||||
|
||||
+3
-3
@@ -16,14 +16,14 @@ import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IProgressService, LongRunningOperation } from 'vs/platform/progress/common/progress';
|
||||
import { toWinJsPromise } from 'vs/base/common/async';
|
||||
import { INextEditorGroupView } from 'vs/workbench/browser/parts/editor/editor';
|
||||
import { IEditorGroupView } from 'vs/workbench/browser/parts/editor/editor';
|
||||
|
||||
export interface IOpenEditorResult {
|
||||
readonly control: BaseEditor;
|
||||
readonly editorChanged: boolean;
|
||||
}
|
||||
|
||||
export class NextEditorControl extends Disposable {
|
||||
export class EditorControl extends Disposable {
|
||||
private dimension: Dimension;
|
||||
private editorOperation: LongRunningOperation;
|
||||
|
||||
@@ -32,7 +32,7 @@ export class NextEditorControl extends Disposable {
|
||||
|
||||
constructor(
|
||||
private parent: HTMLElement,
|
||||
private groupView: INextEditorGroupView,
|
||||
private groupView: IEditorGroupView,
|
||||
@IPartService private partService: IPartService,
|
||||
@IInstantiationService private instantiationService: IInstantiationService,
|
||||
@IProgressService progressService: IProgressService
|
||||
+10
-10
@@ -5,10 +5,10 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import 'vs/css!./media/nextEditorDropTarget';
|
||||
import 'vs/css!./media/editordroptarget';
|
||||
import { LocalSelectionTransfer, DraggedEditorIdentifier, ResourcesDropHandler, DraggedEditorGroupIdentifier, DragAndDropObserver } from 'vs/workbench/browser/dnd';
|
||||
import { addDisposableListener, EventType, EventHelper, isAncestor, toggleClass, addClass, removeClass } from 'vs/base/browser/dom';
|
||||
import { INextEditorGroupsAccessor, EDITOR_TITLE_HEIGHT, INextEditorGroupView, getActiveTextEditorOptions } from 'vs/workbench/browser/parts/editor/editor';
|
||||
import { IEditorGroupsAccessor, EDITOR_TITLE_HEIGHT, IEditorGroupView, getActiveTextEditorOptions } from 'vs/workbench/browser/parts/editor/editor';
|
||||
import { EDITOR_DRAG_AND_DROP_BACKGROUND, Themable } from 'vs/workbench/common/theme';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { activeContrastBorder } from 'vs/platform/theme/common/colorRegistry';
|
||||
@@ -37,8 +37,8 @@ class DropOverlay extends Themable {
|
||||
private readonly groupTransfer = LocalSelectionTransfer.getInstance<DraggedEditorGroupIdentifier>();
|
||||
|
||||
constructor(
|
||||
private accessor: INextEditorGroupsAccessor,
|
||||
private groupView: INextEditorGroupView,
|
||||
private accessor: IEditorGroupsAccessor,
|
||||
private groupView: IEditorGroupView,
|
||||
themeService: IThemeService,
|
||||
private instantiationService: IInstantiationService
|
||||
) {
|
||||
@@ -145,7 +145,7 @@ class DropOverlay extends Themable {
|
||||
}));
|
||||
}
|
||||
|
||||
private findSourceGroupView(): INextEditorGroupView {
|
||||
private findSourceGroupView(): IEditorGroupView {
|
||||
|
||||
// Check for group transfer
|
||||
if (this.groupTransfer.hasData(DraggedEditorGroupIdentifier.prototype)) {
|
||||
@@ -164,7 +164,7 @@ class DropOverlay extends Themable {
|
||||
|
||||
// Determine target group
|
||||
const ensureTargetGroup = () => {
|
||||
let targetGroup: INextEditorGroupView;
|
||||
let targetGroup: IEditorGroupView;
|
||||
if (typeof splitDirection === 'number') {
|
||||
targetGroup = this.accessor.addGroup(this.groupView, splitDirection, { activate: true });
|
||||
} else {
|
||||
@@ -185,7 +185,7 @@ class DropOverlay extends Themable {
|
||||
}
|
||||
|
||||
// Split to new group
|
||||
let targetGroup: INextEditorGroupView;
|
||||
let targetGroup: IEditorGroupView;
|
||||
if (typeof splitDirection === 'number') {
|
||||
if (this.isCopyOperation(event)) {
|
||||
targetGroup = this.accessor.copyGroup(sourceGroup, this.groupView, splitDirection);
|
||||
@@ -342,7 +342,7 @@ class DropOverlay extends Themable {
|
||||
}
|
||||
}
|
||||
|
||||
export class NextEditorDropTarget extends Themable {
|
||||
export class EditorDropTarget extends Themable {
|
||||
|
||||
private _overlay: DropOverlay;
|
||||
|
||||
@@ -352,7 +352,7 @@ export class NextEditorDropTarget extends Themable {
|
||||
private readonly groupTransfer = LocalSelectionTransfer.getInstance<DraggedEditorGroupIdentifier>();
|
||||
|
||||
constructor(
|
||||
private accessor: INextEditorGroupsAccessor,
|
||||
private accessor: IEditorGroupsAccessor,
|
||||
private container: HTMLElement,
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IInstantiationService private instantiationService: IInstantiationService
|
||||
@@ -425,7 +425,7 @@ export class NextEditorDropTarget extends Themable {
|
||||
this.disposeOverlay();
|
||||
}
|
||||
|
||||
private findTargetGroupView(child: HTMLElement): INextEditorGroupView {
|
||||
private findTargetGroupView(child: HTMLElement): IEditorGroupView {
|
||||
const groups = this.accessor.groups;
|
||||
for (let i = 0; i < groups.length; i++) {
|
||||
const groupView = groups[i];
|
||||
+29
-29
@@ -5,7 +5,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import 'vs/css!./media/nextEditorGroupView';
|
||||
import 'vs/css!./media/editorgroupview';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { EditorGroup, IEditorOpenOptions, EditorCloseEvent, ISerializedEditorGroup, isSerializedEditorGroup } from 'vs/workbench/common/editor/editorGroup';
|
||||
import { EditorInput, EditorOptions, GroupIdentifier, ConfirmResult, SideBySideEditorInput, IEditorOpeningEvent, CloseDirection, IEditorCloseEvent } from 'vs/workbench/common/editor';
|
||||
@@ -20,8 +20,8 @@ import { IThemeService, registerThemingParticipant } from 'vs/platform/theme/com
|
||||
import { editorBackground, contrastBorder, focusBorder } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { Themable, EDITOR_GROUP_HEADER_TABS_BORDER, EDITOR_GROUP_HEADER_TABS_BACKGROUND, EDITOR_GROUP_HEADER_NO_TABS_BACKGROUND, EDITOR_GROUP_ACTIVE_EMPTY_BACKGROUND, EDITOR_GROUP_EMPTY_BACKGROUND } from 'vs/workbench/common/theme';
|
||||
import { IMoveEditorOptions, ICopyEditorOptions, ICloseEditorsFilter, IGroupChangeEvent, GroupChangeKind, EditorsOrder } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { NextTabsTitleControl } from 'vs/workbench/browser/parts/editor/nextTabsTitleControl';
|
||||
import { NextEditorControl } from 'vs/workbench/browser/parts/editor/nextEditorControl';
|
||||
import { TabsTitleControl } from 'vs/workbench/browser/parts/editor/tabsTitleControl';
|
||||
import { EditorControl } from 'vs/workbench/browser/parts/editor/editorControl';
|
||||
import { IProgressService } from 'vs/platform/progress/common/progress';
|
||||
import { ProgressService } from 'vs/workbench/services/progress/browser/progressService';
|
||||
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
|
||||
@@ -33,30 +33,30 @@ import { toErrorMessage } from 'vs/base/common/errorMessage';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { RunOnceWorker } from 'vs/base/common/async';
|
||||
import { EventType as TouchEventType, GestureEvent } from 'vs/base/browser/touch';
|
||||
import { NextTitleControl } from 'vs/workbench/browser/parts/editor/nextTitleControl';
|
||||
import { INextEditorGroupsAccessor, INextEditorGroupView, INextEditorPartOptionsChangeEvent, EDITOR_TITLE_HEIGHT, EDITOR_MIN_DIMENSIONS, EDITOR_MAX_DIMENSIONS, getActiveTextEditorOptions } from 'vs/workbench/browser/parts/editor/editor';
|
||||
import { NextNoTabsTitleControl } from './nextNoTabsTitleControl';
|
||||
import { TitleControl } from 'vs/workbench/browser/parts/editor/titleControl';
|
||||
import { IEditorGroupsAccessor, IEditorGroupView, IEditorPartOptionsChangeEvent, EDITOR_TITLE_HEIGHT, EDITOR_MIN_DIMENSIONS, EDITOR_MAX_DIMENSIONS, getActiveTextEditorOptions } from 'vs/workbench/browser/parts/editor/editor';
|
||||
import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
|
||||
import { join } from 'vs/base/common/paths';
|
||||
import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { ActionRunner, IAction, Action } from 'vs/base/common/actions';
|
||||
import { CLOSE_EDITOR_GROUP_COMMAND_ID } from 'vs/workbench/browser/parts/editor/editorCommands';
|
||||
import { NoTabsTitleControl } from 'vs/workbench/browser/parts/editor/noTabsTitleControl';
|
||||
|
||||
export class NextEditorGroupView extends Themable implements INextEditorGroupView {
|
||||
export class EditorGroupView extends Themable implements IEditorGroupView {
|
||||
|
||||
//#region factory
|
||||
|
||||
static createNew(accessor: INextEditorGroupsAccessor, label: string, instantiationService: IInstantiationService): INextEditorGroupView {
|
||||
return instantiationService.createInstance(NextEditorGroupView, accessor, null, label);
|
||||
static createNew(accessor: IEditorGroupsAccessor, label: string, instantiationService: IInstantiationService): IEditorGroupView {
|
||||
return instantiationService.createInstance(EditorGroupView, accessor, null, label);
|
||||
}
|
||||
|
||||
static createFromSerialized(serialized: ISerializedEditorGroup, accessor: INextEditorGroupsAccessor, label: string, instantiationService: IInstantiationService): INextEditorGroupView {
|
||||
return instantiationService.createInstance(NextEditorGroupView, accessor, serialized, label);
|
||||
static createFromSerialized(serialized: ISerializedEditorGroup, accessor: IEditorGroupsAccessor, label: string, instantiationService: IInstantiationService): IEditorGroupView {
|
||||
return instantiationService.createInstance(EditorGroupView, accessor, serialized, label);
|
||||
}
|
||||
|
||||
static createCopy(copyFrom: INextEditorGroupView, accessor: INextEditorGroupsAccessor, label: string, instantiationService: IInstantiationService): INextEditorGroupView {
|
||||
return instantiationService.createInstance(NextEditorGroupView, accessor, copyFrom, label);
|
||||
static createCopy(copyFrom: IEditorGroupView, accessor: IEditorGroupsAccessor, label: string, instantiationService: IInstantiationService): IEditorGroupView {
|
||||
return instantiationService.createInstance(EditorGroupView, accessor, copyFrom, label);
|
||||
}
|
||||
|
||||
//#endregion
|
||||
@@ -98,19 +98,19 @@ export class NextEditorGroupView extends Themable implements INextEditorGroupVie
|
||||
private scopedInstantiationService: IInstantiationService;
|
||||
|
||||
private titleContainer: HTMLElement;
|
||||
private titleAreaControl: NextTitleControl;
|
||||
private titleAreaControl: TitleControl;
|
||||
|
||||
private progressBar: ProgressBar;
|
||||
|
||||
private editorContainer: HTMLElement;
|
||||
private editorControl: NextEditorControl;
|
||||
private editorControl: EditorControl;
|
||||
|
||||
private ignoreOpenEditorErrors: boolean;
|
||||
private disposedEditorsWorker: RunOnceWorker<EditorInput>;
|
||||
|
||||
constructor(
|
||||
private accessor: INextEditorGroupsAccessor,
|
||||
from: INextEditorGroupView | ISerializedEditorGroup,
|
||||
private accessor: IEditorGroupsAccessor,
|
||||
from: IEditorGroupView | ISerializedEditorGroup,
|
||||
private _label: string,
|
||||
@IInstantiationService private instantiationService: IInstantiationService,
|
||||
@IContextKeyService private contextKeyService: IContextKeyService,
|
||||
@@ -122,7 +122,7 @@ export class NextEditorGroupView extends Themable implements INextEditorGroupVie
|
||||
) {
|
||||
super(themeService);
|
||||
|
||||
if (from instanceof NextEditorGroupView) {
|
||||
if (from instanceof EditorGroupView) {
|
||||
this._group = this._register(from.group.clone());
|
||||
} else if (isSerializedEditorGroup(from)) {
|
||||
this._group = this._register(instantiationService.createInstance(EditorGroup, from));
|
||||
@@ -176,7 +176,7 @@ export class NextEditorGroupView extends Themable implements INextEditorGroupVie
|
||||
this.element.appendChild(this.editorContainer);
|
||||
|
||||
// Editor control
|
||||
this.editorControl = this._register(this.scopedInstantiationService.createInstance(NextEditorControl, this.editorContainer, this));
|
||||
this.editorControl = this._register(this.scopedInstantiationService.createInstance(EditorControl, this.editorContainer, this));
|
||||
|
||||
// Track Focus
|
||||
this.doTrackFocus();
|
||||
@@ -302,20 +302,20 @@ export class NextEditorGroupView extends Themable implements INextEditorGroupVie
|
||||
|
||||
// Create new based on options
|
||||
if (this.accessor.partOptions.showTabs) {
|
||||
this.titleAreaControl = this.scopedInstantiationService.createInstance(NextTabsTitleControl, this.titleContainer, this.accessor, this);
|
||||
this.titleAreaControl = this.scopedInstantiationService.createInstance(TabsTitleControl, this.titleContainer, this.accessor, this);
|
||||
} else {
|
||||
this.titleAreaControl = this.scopedInstantiationService.createInstance(NextNoTabsTitleControl, this.titleContainer, this.accessor, this);
|
||||
this.titleAreaControl = this.scopedInstantiationService.createInstance(NoTabsTitleControl, this.titleContainer, this.accessor, this);
|
||||
}
|
||||
}
|
||||
|
||||
private restoreEditors(from: INextEditorGroupView | ISerializedEditorGroup): TPromise<void> {
|
||||
private restoreEditors(from: IEditorGroupView | ISerializedEditorGroup): TPromise<void> {
|
||||
if (this._group.count === 0) {
|
||||
return TPromise.as(void 0); // nothing to show
|
||||
}
|
||||
|
||||
// Determine editor options
|
||||
let options: EditorOptions;
|
||||
if (from instanceof NextEditorGroupView) {
|
||||
if (from instanceof EditorGroupView) {
|
||||
options = getActiveTextEditorOptions(from); // if we copy from another group, ensure to copy its active editor viewstate
|
||||
} else {
|
||||
options = new EditorOptions();
|
||||
@@ -443,7 +443,7 @@ export class NextEditorGroupView extends Themable implements INextEditorGroupVie
|
||||
}
|
||||
}
|
||||
|
||||
private onDidEditorPartOptionsChange(event: INextEditorPartOptionsChangeEvent): void {
|
||||
private onDidEditorPartOptionsChange(event: IEditorPartOptionsChangeEvent): void {
|
||||
|
||||
// Title container
|
||||
this.updateTitleContainer();
|
||||
@@ -494,7 +494,7 @@ export class NextEditorGroupView extends Themable implements INextEditorGroupVie
|
||||
|
||||
//#endregion
|
||||
|
||||
//region INextEditorGroupView
|
||||
//region IEditorGroupView
|
||||
|
||||
get group(): EditorGroup {
|
||||
return this._group;
|
||||
@@ -542,7 +542,7 @@ export class NextEditorGroupView extends Themable implements INextEditorGroupVie
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region INextEditorGroup
|
||||
//#region IEditorGroup
|
||||
|
||||
//#region basics()
|
||||
|
||||
@@ -747,7 +747,7 @@ export class NextEditorGroupView extends Themable implements INextEditorGroupVie
|
||||
|
||||
//#region moveEditor()
|
||||
|
||||
moveEditor(editor: EditorInput, target: INextEditorGroupView, options?: IMoveEditorOptions): void {
|
||||
moveEditor(editor: EditorInput, target: IEditorGroupView, options?: IMoveEditorOptions): void {
|
||||
|
||||
// Move within same group
|
||||
if (this === target) {
|
||||
@@ -783,7 +783,7 @@ export class NextEditorGroupView extends Themable implements INextEditorGroupVie
|
||||
this._onDidGroupChange.fire({ kind: GroupChangeKind.EDITOR_MOVE, editor });
|
||||
}
|
||||
|
||||
private doMoveOrCopyEditorAcrossGroups(editor: EditorInput, target: INextEditorGroupView, moveOptions: IMoveEditorOptions = Object.create(null), keepCopy?: boolean): void {
|
||||
private doMoveOrCopyEditorAcrossGroups(editor: EditorInput, target: IEditorGroupView, moveOptions: IMoveEditorOptions = Object.create(null), keepCopy?: boolean): void {
|
||||
|
||||
// When moving an editor, try to preserve as much view state as possible by checking
|
||||
// for the editor to be a text editor and creating the options accordingly if so
|
||||
@@ -803,7 +803,7 @@ export class NextEditorGroupView extends Themable implements INextEditorGroupVie
|
||||
|
||||
//#region copyEditor()
|
||||
|
||||
copyEditor(editor: EditorInput, target: INextEditorGroupView, options?: ICopyEditorOptions): void {
|
||||
copyEditor(editor: EditorInput, target: IEditorGroupView, options?: ICopyEditorOptions): void {
|
||||
|
||||
// Move within same group because we do not support to show the same editor
|
||||
// multiple times in the same group
|
||||
+62
-62
@@ -18,8 +18,8 @@ import { GroupIdentifier, IWorkbenchEditorConfiguration } from 'vs/workbench/com
|
||||
import { values } from 'vs/base/common/map';
|
||||
import { EDITOR_GROUP_BORDER } from 'vs/workbench/common/theme';
|
||||
import { distinct } from 'vs/base/common/arrays';
|
||||
import { INextEditorGroupsAccessor, INextEditorGroupView, INextEditorPartOptions, getEditorPartOptions, impactsEditorPartOptions, INextEditorPartOptionsChangeEvent, EDITOR_MAX_DIMENSIONS, EDITOR_MIN_DIMENSIONS } from 'vs/workbench/browser/parts/editor/editor';
|
||||
import { NextEditorGroupView } from 'vs/workbench/browser/parts/editor/nextEditorGroupView';
|
||||
import { IEditorGroupsAccessor, IEditorGroupView, IEditorPartOptions, getEditorPartOptions, impactsEditorPartOptions, IEditorPartOptionsChangeEvent, EDITOR_MAX_DIMENSIONS, EDITOR_MIN_DIMENSIONS } from 'vs/workbench/browser/parts/editor/editor';
|
||||
import { EditorGroupView } from 'vs/workbench/browser/parts/editor/editorGroupView';
|
||||
import { IConfigurationService, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration';
|
||||
import { IDisposable, dispose, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
@@ -32,41 +32,41 @@ import { GroupOrientation as LegacyGroupOrientation } from 'vs/workbench/service
|
||||
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
|
||||
import { IWindowService } from 'vs/platform/windows/common/windows';
|
||||
import { ILifecycleService, LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { NextEditorDropTarget } from 'vs/workbench/browser/parts/editor/nextEditorDropTarget';
|
||||
import { EditorDropTarget } from 'vs/workbench/browser/parts/editor/editorDropTarget';
|
||||
import { localize } from 'vs/nls';
|
||||
|
||||
// TODO@grid enable minimized/maximized groups in one dimension
|
||||
// - doCreateGroupView(): needs listener if the view gets minimized, the previous active group should become active
|
||||
// - doSetGroupActive(): needs a listener if the group is minimized, it should now restore to be maximized
|
||||
|
||||
interface INextEditorPartUIState {
|
||||
interface IEditorPartUIState {
|
||||
serializedGrid: ISerializedGrid;
|
||||
activeGroup: GroupIdentifier;
|
||||
mostRecentActiveGroups: GroupIdentifier[];
|
||||
}
|
||||
|
||||
export class NextEditorPart extends Part implements INextEditorGroupsService, INextEditorGroupsAccessor {
|
||||
export class EditorPart extends Part implements INextEditorGroupsService, IEditorGroupsAccessor {
|
||||
|
||||
_serviceBrand: any;
|
||||
|
||||
private static readonly NEXT_EDITOR_PART_UI_STATE_STORAGE_KEY = 'nexteditorpart.uiState';
|
||||
private static readonly EDITOR_PART_UI_STATE_STORAGE_KEY = 'editorpart.uiState';
|
||||
|
||||
//#region Events
|
||||
|
||||
private _onDidLayout: Emitter<Dimension> = this._register(new Emitter<Dimension>());
|
||||
get onDidLayout(): Event<Dimension> { return this._onDidLayout.event; }
|
||||
|
||||
private _onDidActiveGroupChange: Emitter<INextEditorGroupView> = this._register(new Emitter<INextEditorGroupView>());
|
||||
get onDidActiveGroupChange(): Event<INextEditorGroupView> { return this._onDidActiveGroupChange.event; }
|
||||
private _onDidActiveGroupChange: Emitter<IEditorGroupView> = this._register(new Emitter<IEditorGroupView>());
|
||||
get onDidActiveGroupChange(): Event<IEditorGroupView> { return this._onDidActiveGroupChange.event; }
|
||||
|
||||
private _onDidAddGroup: Emitter<INextEditorGroupView> = this._register(new Emitter<INextEditorGroupView>());
|
||||
get onDidAddGroup(): Event<INextEditorGroupView> { return this._onDidAddGroup.event; }
|
||||
private _onDidAddGroup: Emitter<IEditorGroupView> = this._register(new Emitter<IEditorGroupView>());
|
||||
get onDidAddGroup(): Event<IEditorGroupView> { return this._onDidAddGroup.event; }
|
||||
|
||||
private _onDidRemoveGroup: Emitter<INextEditorGroupView> = this._register(new Emitter<INextEditorGroupView>());
|
||||
get onDidRemoveGroup(): Event<INextEditorGroupView> { return this._onDidRemoveGroup.event; }
|
||||
private _onDidRemoveGroup: Emitter<IEditorGroupView> = this._register(new Emitter<IEditorGroupView>());
|
||||
get onDidRemoveGroup(): Event<IEditorGroupView> { return this._onDidRemoveGroup.event; }
|
||||
|
||||
private _onDidMoveGroup: Emitter<INextEditorGroupView> = this._register(new Emitter<INextEditorGroupView>());
|
||||
get onDidMoveGroup(): Event<INextEditorGroupView> { return this._onDidMoveGroup.event; }
|
||||
private _onDidMoveGroup: Emitter<IEditorGroupView> = this._register(new Emitter<IEditorGroupView>());
|
||||
get onDidMoveGroup(): Event<IEditorGroupView> { return this._onDidMoveGroup.event; }
|
||||
|
||||
private _onDidPreferredSizeChange: Emitter<void> = this._register(new Emitter<void>());
|
||||
get onDidPreferredSizeChange(): Event<void> { return this._onDidPreferredSizeChange.event; }
|
||||
@@ -77,14 +77,14 @@ export class NextEditorPart extends Part implements INextEditorGroupsService, IN
|
||||
private _preferredSize: Dimension;
|
||||
|
||||
private memento: object;
|
||||
private _partOptions: INextEditorPartOptions;
|
||||
private _partOptions: IEditorPartOptions;
|
||||
|
||||
private _activeGroup: INextEditorGroupView;
|
||||
private groupViews: Map<GroupIdentifier, INextEditorGroupView> = new Map<GroupIdentifier, INextEditorGroupView>();
|
||||
private _activeGroup: IEditorGroupView;
|
||||
private groupViews: Map<GroupIdentifier, IEditorGroupView> = new Map<GroupIdentifier, IEditorGroupView>();
|
||||
private mostRecentActiveGroups: GroupIdentifier[] = [];
|
||||
|
||||
private container: HTMLElement;
|
||||
private gridWidget: SerializableGrid<INextEditorGroupView>;
|
||||
private gridWidget: SerializableGrid<IEditorGroupView>;
|
||||
|
||||
private _whenRestored: TPromise<void>;
|
||||
private whenRestoredComplete: TValueCallback<void>;
|
||||
@@ -114,10 +114,10 @@ export class NextEditorPart extends Part implements INextEditorGroupsService, IN
|
||||
|
||||
//#region IEditorPartOptions
|
||||
|
||||
private enforcedPartOptions: INextEditorPartOptions[] = [];
|
||||
private enforcedPartOptions: IEditorPartOptions[] = [];
|
||||
|
||||
private _onDidEditorPartOptionsChange: Emitter<INextEditorPartOptionsChangeEvent> = this._register(new Emitter<INextEditorPartOptionsChangeEvent>());
|
||||
get onDidEditorPartOptionsChange(): Event<INextEditorPartOptionsChangeEvent> { return this._onDidEditorPartOptionsChange.event; }
|
||||
private _onDidEditorPartOptionsChange: Emitter<IEditorPartOptionsChangeEvent> = this._register(new Emitter<IEditorPartOptionsChangeEvent>());
|
||||
get onDidEditorPartOptionsChange(): Event<IEditorPartOptionsChangeEvent> { return this._onDidEditorPartOptionsChange.event; }
|
||||
|
||||
private registerListeners(): void {
|
||||
this._register(this.configurationService.onDidChangeConfiguration(e => this.onConfigurationUpdated(e)));
|
||||
@@ -142,11 +142,11 @@ export class NextEditorPart extends Part implements INextEditorGroupsService, IN
|
||||
this._onDidEditorPartOptionsChange.fire({ oldPartOptions, newPartOptions });
|
||||
}
|
||||
|
||||
get partOptions(): INextEditorPartOptions {
|
||||
get partOptions(): IEditorPartOptions {
|
||||
return this._partOptions;
|
||||
}
|
||||
|
||||
enforcePartOptions(options: INextEditorPartOptions): IDisposable {
|
||||
enforcePartOptions(options: IEditorPartOptions): IDisposable {
|
||||
this.enforcedPartOptions.push(options);
|
||||
this.handleChangedPartOptions();
|
||||
|
||||
@@ -158,13 +158,13 @@ export class NextEditorPart extends Part implements INextEditorGroupsService, IN
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region INextEditorGroupsService
|
||||
//#region IEditorGroupsService
|
||||
|
||||
get activeGroup(): INextEditorGroupView {
|
||||
get activeGroup(): IEditorGroupView {
|
||||
return this._activeGroup;
|
||||
}
|
||||
|
||||
get groups(): INextEditorGroupView[] {
|
||||
get groups(): IEditorGroupView[] {
|
||||
return values(this.groupViews);
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ export class NextEditorPart extends Part implements INextEditorGroupsService, IN
|
||||
return this._whenRestored;
|
||||
}
|
||||
|
||||
getGroups(order = GroupsOrder.CREATION_TIME): INextEditorGroupView[] {
|
||||
getGroups(order = GroupsOrder.CREATION_TIME): IEditorGroupView[] {
|
||||
switch (order) {
|
||||
case GroupsOrder.CREATION_TIME:
|
||||
return this.groups;
|
||||
@@ -197,7 +197,7 @@ export class NextEditorPart extends Part implements INextEditorGroupsService, IN
|
||||
return distinct([...mostRecentActive, ...this.groups]);
|
||||
|
||||
case GroupsOrder.GRID_APPEARANCE:
|
||||
const views: INextEditorGroupView[] = [];
|
||||
const views: IEditorGroupView[] = [];
|
||||
if (this.gridWidget) {
|
||||
this.fillGridNodes(views, this.gridWidget.getViews());
|
||||
}
|
||||
@@ -206,7 +206,7 @@ export class NextEditorPart extends Part implements INextEditorGroupsService, IN
|
||||
}
|
||||
}
|
||||
|
||||
private fillGridNodes(target: INextEditorGroupView[], node: GridBranchNode<INextEditorGroupView> | GridNode<INextEditorGroupView>): void {
|
||||
private fillGridNodes(target: IEditorGroupView[], node: GridBranchNode<IEditorGroupView> | GridNode<IEditorGroupView>): void {
|
||||
if (isGridBranchNode(node)) {
|
||||
node.children.forEach(child => this.fillGridNodes(target, child));
|
||||
} else {
|
||||
@@ -214,11 +214,11 @@ export class NextEditorPart extends Part implements INextEditorGroupsService, IN
|
||||
}
|
||||
}
|
||||
|
||||
getGroup(identifier: GroupIdentifier): INextEditorGroupView {
|
||||
getGroup(identifier: GroupIdentifier): IEditorGroupView {
|
||||
return this.groupViews.get(identifier);
|
||||
}
|
||||
|
||||
findGroup(scope: IFindGroupScope, source: INextEditorGroupView | GroupIdentifier = this.activeGroup): INextEditorGroupView {
|
||||
findGroup(scope: IFindGroupScope, source: IEditorGroupView | GroupIdentifier = this.activeGroup): IEditorGroupView {
|
||||
|
||||
// by direction
|
||||
if (typeof scope.direction === 'number') {
|
||||
@@ -229,7 +229,7 @@ export class NextEditorPart extends Part implements INextEditorGroupsService, IN
|
||||
return this.doFindGroupByLocation(scope.location, source);
|
||||
}
|
||||
|
||||
private doFindGroupByDirection(direction: GroupDirection, source: INextEditorGroupView | GroupIdentifier): INextEditorGroupView {
|
||||
private doFindGroupByDirection(direction: GroupDirection, source: IEditorGroupView | GroupIdentifier): IEditorGroupView {
|
||||
const sourceGroupView = this.assertGroupView(source);
|
||||
const groups = this.getGroups(GroupsOrder.GRID_APPEARANCE);
|
||||
const index = groups.indexOf(sourceGroupView);
|
||||
@@ -242,7 +242,7 @@ export class NextEditorPart extends Part implements INextEditorGroupsService, IN
|
||||
return void 0;
|
||||
}
|
||||
|
||||
private doFindGroupByLocation(location: GroupLocation, source: INextEditorGroupView | GroupIdentifier): INextEditorGroupView {
|
||||
private doFindGroupByLocation(location: GroupLocation, source: IEditorGroupView | GroupIdentifier): IEditorGroupView {
|
||||
const sourceGroupView = this.assertGroupView(source);
|
||||
const groups = this.getGroups(GroupsOrder.CREATION_TIME);
|
||||
const index = groups.indexOf(sourceGroupView);
|
||||
@@ -259,14 +259,14 @@ export class NextEditorPart extends Part implements INextEditorGroupsService, IN
|
||||
}
|
||||
}
|
||||
|
||||
activateGroup(group: INextEditorGroupView | GroupIdentifier): INextEditorGroupView {
|
||||
activateGroup(group: IEditorGroupView | GroupIdentifier): IEditorGroupView {
|
||||
const groupView = this.assertGroupView(group);
|
||||
this.doSetGroupActive(groupView);
|
||||
|
||||
return groupView;
|
||||
}
|
||||
|
||||
focusGroup(group: INextEditorGroupView | GroupIdentifier): INextEditorGroupView {
|
||||
focusGroup(group: IEditorGroupView | GroupIdentifier): IEditorGroupView {
|
||||
const groupView = this.assertGroupView(group);
|
||||
|
||||
// Activate and focus group
|
||||
@@ -276,7 +276,7 @@ export class NextEditorPart extends Part implements INextEditorGroupsService, IN
|
||||
return groupView;
|
||||
}
|
||||
|
||||
resizeGroup(group: INextEditorGroupView | GroupIdentifier, sizeDelta: number): INextEditorGroupView {
|
||||
resizeGroup(group: IEditorGroupView | GroupIdentifier, sizeDelta: number): IEditorGroupView {
|
||||
const groupView = this.assertGroupView(group);
|
||||
const currentSize = this.gridWidget.getViewSize(groupView);
|
||||
|
||||
@@ -332,7 +332,7 @@ export class NextEditorPart extends Part implements INextEditorGroupsService, IN
|
||||
}
|
||||
}
|
||||
|
||||
addGroup(location: INextEditorGroupView | GroupIdentifier, direction: GroupDirection, options?: IAddGroupOptions): INextEditorGroupView {
|
||||
addGroup(location: IEditorGroupView | GroupIdentifier, direction: GroupDirection, options?: IAddGroupOptions): IEditorGroupView {
|
||||
const locationView = this.assertGroupView(location);
|
||||
|
||||
const group = this.doAddGroup(locationView, direction);
|
||||
@@ -344,7 +344,7 @@ export class NextEditorPart extends Part implements INextEditorGroupsService, IN
|
||||
return group;
|
||||
}
|
||||
|
||||
private doAddGroup(locationView: INextEditorGroupView, direction: GroupDirection, groupToCopy?: INextEditorGroupView): INextEditorGroupView {
|
||||
private doAddGroup(locationView: IEditorGroupView, direction: GroupDirection, groupToCopy?: IEditorGroupView): IEditorGroupView {
|
||||
const newGroupView = this.doCreateGroupView(groupToCopy);
|
||||
|
||||
// Add to grid widget
|
||||
@@ -367,19 +367,19 @@ export class NextEditorPart extends Part implements INextEditorGroupsService, IN
|
||||
return newGroupView;
|
||||
}
|
||||
|
||||
private doCreateGroupView(from?: INextEditorGroupView | ISerializedEditorGroup): INextEditorGroupView {
|
||||
private doCreateGroupView(from?: IEditorGroupView | ISerializedEditorGroup): IEditorGroupView {
|
||||
|
||||
// Label: just use the number of existing groups as label
|
||||
const label = this.getGroupLabel(this.count + 1);
|
||||
|
||||
// Create group view
|
||||
let groupView: INextEditorGroupView;
|
||||
if (from instanceof NextEditorGroupView) {
|
||||
groupView = NextEditorGroupView.createCopy(from, this, label, this.instantiationService);
|
||||
let groupView: IEditorGroupView;
|
||||
if (from instanceof EditorGroupView) {
|
||||
groupView = EditorGroupView.createCopy(from, this, label, this.instantiationService);
|
||||
} else if (isSerializedEditorGroup(from)) {
|
||||
groupView = NextEditorGroupView.createFromSerialized(from, this, label, this.instantiationService);
|
||||
groupView = EditorGroupView.createFromSerialized(from, this, label, this.instantiationService);
|
||||
} else {
|
||||
groupView = NextEditorGroupView.createNew(this, label, this.instantiationService);
|
||||
groupView = EditorGroupView.createNew(this, label, this.instantiationService);
|
||||
}
|
||||
|
||||
// Keep in map
|
||||
@@ -408,7 +408,7 @@ export class NextEditorPart extends Part implements INextEditorGroupsService, IN
|
||||
return groupView;
|
||||
}
|
||||
|
||||
private doSetGroupActive(group: INextEditorGroupView): void {
|
||||
private doSetGroupActive(group: IEditorGroupView): void {
|
||||
if (this._activeGroup === group) {
|
||||
return; // return if this is already the active group
|
||||
}
|
||||
@@ -431,7 +431,7 @@ export class NextEditorPart extends Part implements INextEditorGroupsService, IN
|
||||
this._onDidActiveGroupChange.fire(group);
|
||||
}
|
||||
|
||||
private doUpdateMostRecentActive(group: INextEditorGroupView, makeMostRecentlyActive?: boolean): void {
|
||||
private doUpdateMostRecentActive(group: IEditorGroupView, makeMostRecentlyActive?: boolean): void {
|
||||
const index = this.mostRecentActiveGroups.indexOf(group.id);
|
||||
|
||||
// Remove from MRU list
|
||||
@@ -454,7 +454,7 @@ export class NextEditorPart extends Part implements INextEditorGroupsService, IN
|
||||
}
|
||||
}
|
||||
|
||||
removeGroup(group: INextEditorGroupView | GroupIdentifier): void {
|
||||
removeGroup(group: IEditorGroupView | GroupIdentifier): void {
|
||||
const groupView = this.assertGroupView(group);
|
||||
if (this.groupViews.size === 1) {
|
||||
return; // Cannot remove the last root group
|
||||
@@ -469,10 +469,10 @@ export class NextEditorPart extends Part implements INextEditorGroupsService, IN
|
||||
this.doRemoveGroupWithEditors(groupView);
|
||||
}
|
||||
|
||||
private doRemoveGroupWithEditors(groupView: INextEditorGroupView): void {
|
||||
private doRemoveGroupWithEditors(groupView: IEditorGroupView): void {
|
||||
const mostRecentlyActiveGroups = this.getGroups(GroupsOrder.MOST_RECENTLY_ACTIVE);
|
||||
|
||||
let lastActiveGroup: INextEditorGroupView;
|
||||
let lastActiveGroup: IEditorGroupView;
|
||||
if (this._activeGroup === groupView) {
|
||||
lastActiveGroup = mostRecentlyActiveGroups[1];
|
||||
} else {
|
||||
@@ -484,7 +484,7 @@ export class NextEditorPart extends Part implements INextEditorGroupsService, IN
|
||||
this.mergeGroup(groupView, lastActiveGroup);
|
||||
}
|
||||
|
||||
private doRemoveEmptyGroup(groupView: INextEditorGroupView): void {
|
||||
private doRemoveEmptyGroup(groupView: IEditorGroupView): void {
|
||||
const groupHasFocus = isAncestor(document.activeElement, groupView.element);
|
||||
|
||||
// Activate next group if the removed one was active
|
||||
@@ -525,7 +525,7 @@ export class NextEditorPart extends Part implements INextEditorGroupsService, IN
|
||||
return localize('groupLabel', "Group {0}", index);
|
||||
}
|
||||
|
||||
moveGroup(group: INextEditorGroupView | GroupIdentifier, location: INextEditorGroupView | GroupIdentifier, direction: GroupDirection): INextEditorGroupView {
|
||||
moveGroup(group: IEditorGroupView | GroupIdentifier, location: IEditorGroupView | GroupIdentifier, direction: GroupDirection): IEditorGroupView {
|
||||
const sourceView = this.assertGroupView(group);
|
||||
const targetView = this.assertGroupView(location);
|
||||
|
||||
@@ -551,7 +551,7 @@ export class NextEditorPart extends Part implements INextEditorGroupsService, IN
|
||||
return sourceView;
|
||||
}
|
||||
|
||||
copyGroup(group: INextEditorGroupView | GroupIdentifier, location: INextEditorGroupView | GroupIdentifier, direction: GroupDirection): INextEditorGroupView {
|
||||
copyGroup(group: IEditorGroupView | GroupIdentifier, location: IEditorGroupView | GroupIdentifier, direction: GroupDirection): IEditorGroupView {
|
||||
const groupView = this.assertGroupView(group);
|
||||
const locationView = this.assertGroupView(location);
|
||||
|
||||
@@ -568,7 +568,7 @@ export class NextEditorPart extends Part implements INextEditorGroupsService, IN
|
||||
return copiedGroupView;
|
||||
}
|
||||
|
||||
mergeGroup(group: INextEditorGroupView | GroupIdentifier, target: INextEditorGroupView | GroupIdentifier, options?: IMergeGroupOptions): INextEditorGroupView {
|
||||
mergeGroup(group: IEditorGroupView | GroupIdentifier, target: IEditorGroupView | GroupIdentifier, options?: IMergeGroupOptions): IEditorGroupView {
|
||||
const sourceView = this.assertGroupView(group);
|
||||
const targetView = this.assertGroupView(target);
|
||||
|
||||
@@ -595,7 +595,7 @@ export class NextEditorPart extends Part implements INextEditorGroupsService, IN
|
||||
return targetView;
|
||||
}
|
||||
|
||||
private assertGroupView(group: INextEditorGroupView | GroupIdentifier): INextEditorGroupView {
|
||||
private assertGroupView(group: IEditorGroupView | GroupIdentifier): IEditorGroupView {
|
||||
if (typeof group === 'number') {
|
||||
group = this.getGroup(group);
|
||||
}
|
||||
@@ -655,7 +655,7 @@ export class NextEditorPart extends Part implements INextEditorGroupsService, IN
|
||||
this.doCreateGridControl(this.container);
|
||||
|
||||
// Drop support
|
||||
this._register(this.instantiationService.createInstance(NextEditorDropTarget, this, this.container));
|
||||
this._register(this.instantiationService.createInstance(EditorDropTarget, this, this.container));
|
||||
|
||||
return this.container;
|
||||
}
|
||||
@@ -722,16 +722,16 @@ export class NextEditorPart extends Part implements INextEditorGroupsService, IN
|
||||
}
|
||||
}
|
||||
|
||||
private doGetPreviousState(): INextEditorPartUIState {
|
||||
private doGetPreviousState(): IEditorPartUIState {
|
||||
const legacyState = this.doGetPreviousLegacyState();
|
||||
if (legacyState) {
|
||||
return legacyState; // TODO@ben remove after a while
|
||||
}
|
||||
|
||||
return this.memento[NextEditorPart.NEXT_EDITOR_PART_UI_STATE_STORAGE_KEY] as INextEditorPartUIState;
|
||||
return this.memento[EditorPart.EDITOR_PART_UI_STATE_STORAGE_KEY] as IEditorPartUIState;
|
||||
}
|
||||
|
||||
private doGetPreviousLegacyState(): INextEditorPartUIState {
|
||||
private doGetPreviousLegacyState(): IEditorPartUIState {
|
||||
const LEGACY_EDITOR_PART_UI_STATE_STORAGE_KEY = 'editorpart.uiState';
|
||||
const LEGACY_STACKS_MODEL_STORAGE_KEY = 'editorStacks.model';
|
||||
|
||||
@@ -765,7 +765,7 @@ export class NextEditorPart extends Part implements INextEditorGroupsService, IN
|
||||
if (legacyUIState && Array.isArray(legacyUIState.groups) && legacyUIState.groups.length > 0) {
|
||||
const splitHorizontally = legacyPartState && legacyPartState.groupOrientation === 'horizontal';
|
||||
|
||||
const legacyState: INextEditorPartUIState = Object.create(null);
|
||||
const legacyState: IEditorPartUIState = Object.create(null);
|
||||
|
||||
const positionOneGroup = legacyUIState.groups[0];
|
||||
const positionTwoGroup = legacyUIState.groups[1];
|
||||
@@ -878,16 +878,16 @@ export class NextEditorPart extends Part implements INextEditorGroupsService, IN
|
||||
|
||||
// Persist grid UI state
|
||||
if (this.gridWidget) {
|
||||
const uiState: INextEditorPartUIState = {
|
||||
const uiState: IEditorPartUIState = {
|
||||
serializedGrid: this.gridWidget.serialize(),
|
||||
activeGroup: this._activeGroup.id,
|
||||
mostRecentActiveGroups: this.mostRecentActiveGroups
|
||||
};
|
||||
|
||||
if (this.isEmpty()) {
|
||||
delete this.memento[NextEditorPart.NEXT_EDITOR_PART_UI_STATE_STORAGE_KEY];
|
||||
delete this.memento[EditorPart.EDITOR_PART_UI_STATE_STORAGE_KEY];
|
||||
} else {
|
||||
this.memento[NextEditorPart.NEXT_EDITOR_PART_UI_STATE_STORAGE_KEY] = uiState;
|
||||
this.memento[EditorPart.EDITOR_PART_UI_STATE_STORAGE_KEY] = uiState;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ import { getIconClasses } from 'vs/workbench/browser/labels';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { QuickOpenHandler } from 'vs/workbench/browser/quickopen';
|
||||
import { INextEditorService } from 'vs/workbench/services/editor/common/nextEditorService';
|
||||
import { INextEditorGroupsService, INextEditorGroup, EditorsOrder, GroupsOrder } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { INextEditorGroupsService, IEditorGroup, EditorsOrder, GroupsOrder } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { EditorInput, toResource } from 'vs/workbench/common/editor';
|
||||
import { compareItemsByScore, scoreItem, ScorerCache, prepareQuery } from 'vs/base/parts/quickopen/common/quickOpenScorer';
|
||||
@@ -25,7 +25,7 @@ export class EditorPickerEntry extends QuickOpenEntryGroup {
|
||||
|
||||
constructor(
|
||||
private editor: EditorInput,
|
||||
private _group: INextEditorGroup,
|
||||
private _group: IEditorGroup,
|
||||
@IModeService private modeService: IModeService,
|
||||
@IModelService private modelService: IModelService
|
||||
) {
|
||||
@@ -47,7 +47,7 @@ export class EditorPickerEntry extends QuickOpenEntryGroup {
|
||||
return this.editor.isDirty() ? 'dirty' : '';
|
||||
}
|
||||
|
||||
public get group(): INextEditorGroup {
|
||||
public get group(): IEditorGroup {
|
||||
return this._group;
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ export abstract class BaseEditorPicker extends QuickOpenHandler {
|
||||
|
||||
// Grouping (for more than one group)
|
||||
if (this.editorGroupService.count > 1) {
|
||||
let lastGroup: INextEditorGroup;
|
||||
let lastGroup: IEditorGroup;
|
||||
entries.forEach(e => {
|
||||
if (!lastGroup || lastGroup !== e.group) {
|
||||
e.setGroupLabel(e.group.label);
|
||||
@@ -157,7 +157,7 @@ export class ActiveEditorGroupPicker extends BaseEditorPicker {
|
||||
return this.group.getEditors(EditorsOrder.MOST_RECENTLY_ACTIVE).map((editor, index) => this.instantiationService.createInstance(EditorPickerEntry, editor, this.group));
|
||||
}
|
||||
|
||||
private get group(): INextEditorGroup {
|
||||
private get group(): IEditorGroup {
|
||||
return this.editorGroupService.activeGroup;
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -5,16 +5,16 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import 'vs/css!./media/nextNoTabsTitleControl';
|
||||
import 'vs/css!./media/notabstitlecontrol';
|
||||
import { toResource, Verbosity, IEditorInput } from 'vs/workbench/common/editor';
|
||||
import { NextTitleControl } from 'vs/workbench/browser/parts/editor/nextTitleControl';
|
||||
import { TitleControl } from 'vs/workbench/browser/parts/editor/titleControl';
|
||||
import { ResourceLabel } from 'vs/workbench/browser/labels';
|
||||
import { TAB_ACTIVE_FOREGROUND, TAB_UNFOCUSED_ACTIVE_FOREGROUND } from 'vs/workbench/common/theme';
|
||||
import { EventType as TouchEventType, GestureEvent, Gesture } from 'vs/base/browser/touch';
|
||||
import { addDisposableListener, EventType, addClass, EventHelper, removeClass } from 'vs/base/browser/dom';
|
||||
import { INextEditorPartOptions } from 'vs/workbench/browser/parts/editor/editor';
|
||||
import { IEditorPartOptions } from 'vs/workbench/browser/parts/editor/editor';
|
||||
|
||||
export class NextNoTabsTitleControl extends NextTitleControl {
|
||||
export class NoTabsTitleControl extends TitleControl {
|
||||
private titleContainer: HTMLElement;
|
||||
private editorLabel: ResourceLabel;
|
||||
private lastRenderedEditor: IEditorInput;
|
||||
@@ -124,7 +124,7 @@ export class NextNoTabsTitleControl extends NextTitleControl {
|
||||
});
|
||||
}
|
||||
|
||||
updateOptions(oldOptions: INextEditorPartOptions, newOptions: INextEditorPartOptions): void {
|
||||
updateOptions(oldOptions: IEditorPartOptions, newOptions: IEditorPartOptions): void {
|
||||
if (oldOptions.labelFormat !== newOptions.labelFormat) {
|
||||
this.redraw();
|
||||
}
|
||||
@@ -15,7 +15,7 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { scrollbarShadow } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { IEditorRegistry, Extensions as EditorExtensions } from 'vs/workbench/browser/editor';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { INextEditorGroup } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { IEditorGroup } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
|
||||
export class SideBySideEditor extends BaseEditor {
|
||||
|
||||
@@ -56,7 +56,7 @@ export class SideBySideEditor extends BaseEditor {
|
||||
}
|
||||
}
|
||||
|
||||
protected setEditorVisible(visible: boolean, group: INextEditorGroup): void {
|
||||
protected setEditorVisible(visible: boolean, group: IEditorGroup): void {
|
||||
if (this.masterEditor) {
|
||||
this.masterEditor.setVisible(visible, group);
|
||||
}
|
||||
|
||||
+8
-8
@@ -5,7 +5,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import 'vs/css!./media/nextTabsTitleControl';
|
||||
import 'vs/css!./media/tabstitlecontrol';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { isMacintosh } from 'vs/base/common/platform';
|
||||
import { shorten } from 'vs/base/common/labels';
|
||||
@@ -22,7 +22,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IMenuService } from 'vs/platform/actions/common/actions';
|
||||
import { NextTitleControl } from 'vs/workbench/browser/parts/editor/nextTitleControl';
|
||||
import { TitleControl } from 'vs/workbench/browser/parts/editor/titleControl';
|
||||
import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen';
|
||||
import { IDisposable, dispose, combinedDisposable } from 'vs/base/common/lifecycle';
|
||||
import { ScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement';
|
||||
@@ -35,11 +35,11 @@ import { ResourcesDropHandler, fillResourceDataTransfers, DraggedEditorIdentifie
|
||||
import { Color } from 'vs/base/common/color';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { INextEditorGroup } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { IEditorGroup } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
|
||||
import { addClass, addDisposableListener, hasClass, EventType, EventHelper, removeClass, Dimension, scheduleAtNextAnimationFrame, findParentWithClass, clearNode } from 'vs/base/browser/dom';
|
||||
import { localize } from 'vs/nls';
|
||||
import { INextEditorGroupsAccessor, INextEditorPartOptions } from 'vs/workbench/browser/parts/editor/editor';
|
||||
import { IEditorGroupsAccessor, IEditorPartOptions } from 'vs/workbench/browser/parts/editor/editor';
|
||||
|
||||
interface IEditorInputLabel {
|
||||
name: string;
|
||||
@@ -49,7 +49,7 @@ interface IEditorInputLabel {
|
||||
|
||||
type AugmentedLabel = IEditorInputLabel & { editor: IEditorInput };
|
||||
|
||||
export class NextTabsTitleControl extends NextTitleControl {
|
||||
export class TabsTitleControl extends TitleControl {
|
||||
|
||||
private titleContainer: HTMLElement;
|
||||
private tabsContainer: HTMLElement;
|
||||
@@ -66,8 +66,8 @@ export class NextTabsTitleControl extends NextTitleControl {
|
||||
|
||||
constructor(
|
||||
parent: HTMLElement,
|
||||
accessor: INextEditorGroupsAccessor,
|
||||
group: INextEditorGroup,
|
||||
accessor: IEditorGroupsAccessor,
|
||||
group: IEditorGroup,
|
||||
@IContextMenuService contextMenuService: IContextMenuService,
|
||||
@IInstantiationService instantiationService: IInstantiationService,
|
||||
@IUntitledEditorService private untitledEditorService: IUntitledEditorService,
|
||||
@@ -335,7 +335,7 @@ export class NextTabsTitleControl extends NextTitleControl {
|
||||
this.withTab(editor, tabContainer => this.redrawEditorDirty(editor, tabContainer));
|
||||
}
|
||||
|
||||
updateOptions(oldOptions: INextEditorPartOptions, newOptions: INextEditorPartOptions): void {
|
||||
updateOptions(oldOptions: IEditorPartOptions, newOptions: IEditorPartOptions): void {
|
||||
|
||||
// A change to a label format options requires to recompute all labels
|
||||
if (oldOptions.labelFormat !== newOptions.labelFormat) {
|
||||
@@ -37,7 +37,7 @@ import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { once } from 'vs/base/common/event';
|
||||
import { DelegatingWorkbenchEditorService } from 'vs/workbench/services/editor/browser/nextEditorService';
|
||||
import { INextEditorGroup, INextEditorGroupsService } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { IEditorGroup, INextEditorGroupsService } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { INextEditorService } from 'vs/workbench/services/editor/common/nextEditorService';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
|
||||
@@ -93,7 +93,7 @@ export class TextDiffEditor extends BaseTextEditor {
|
||||
|
||||
// Support navigation within the diff editor by overriding the editor service within
|
||||
const delegatingEditorService = this.instantiationService.createInstance(DelegatingWorkbenchEditorService);
|
||||
delegatingEditorService.setEditorOpenHandler((group: INextEditorGroup, input: EditorInput, options?: EditorOptions) => {
|
||||
delegatingEditorService.setEditorOpenHandler((group: IEditorGroup, input: EditorInput, options?: EditorOptions) => {
|
||||
|
||||
// Check if target group is same as this editor ones
|
||||
if (group === this.group) {
|
||||
|
||||
@@ -24,7 +24,7 @@ import { ITextFileService, SaveReason, AutoSaveMode } from 'vs/workbench/service
|
||||
import { ITextResourceConfigurationService } from 'vs/editor/common/services/resourceConfiguration';
|
||||
import { IEditorOptions } from 'vs/editor/common/config/editorOptions';
|
||||
import { isDiffEditor, isCodeEditor, ICodeEditor, getCodeEditor } from 'vs/editor/browser/editorBrowser';
|
||||
import { INextEditorGroupsService, INextEditorGroup } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { INextEditorGroupsService, IEditorGroup } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { INextEditorService } from 'vs/workbench/services/editor/common/nextEditorService';
|
||||
|
||||
@@ -197,7 +197,7 @@ export abstract class BaseTextEditor extends BaseEditor {
|
||||
});
|
||||
}
|
||||
|
||||
protected setEditorVisible(visible: boolean, group: INextEditorGroup): void {
|
||||
protected setEditorVisible(visible: boolean, group: IEditorGroup): void {
|
||||
|
||||
// Pass on to Editor
|
||||
if (visible) {
|
||||
|
||||
+8
-8
@@ -5,7 +5,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import 'vs/css!./media/nextTitleControl';
|
||||
import 'vs/css!./media/titlecontrol';
|
||||
import { localize } from 'vs/nls';
|
||||
import { prepareActions } from 'vs/workbench/browser/actions';
|
||||
import { IAction, Action, IRunEvent } from 'vs/base/common/actions';
|
||||
@@ -34,8 +34,8 @@ import { getCodeEditor } from 'vs/editor/browser/editorBrowser';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { Dimension, addDisposableListener, EventType } from 'vs/base/browser/dom';
|
||||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { INextEditorGroup } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { INextEditorGroupsAccessor, INextEditorPartOptions } from 'vs/workbench/browser/parts/editor/editor';
|
||||
import { IEditorGroup } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { IEditorGroupsAccessor, IEditorPartOptions } from 'vs/workbench/browser/parts/editor/editor';
|
||||
import { listActiveSelectionBackground, listActiveSelectionForeground } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { LocalSelectionTransfer, DraggedEditorGroupIdentifier, DraggedEditorIdentifier, fillResourceDataTransfers } from 'vs/workbench/browser/dnd';
|
||||
import { applyDragImage } from 'vs/base/browser/dnd';
|
||||
@@ -45,7 +45,7 @@ export interface IToolbarActions {
|
||||
secondary: IAction[];
|
||||
}
|
||||
|
||||
export abstract class NextTitleControl extends Themable {
|
||||
export abstract class TitleControl extends Themable {
|
||||
|
||||
protected closeOneEditorAction: CloseOneEditorAction;
|
||||
|
||||
@@ -68,8 +68,8 @@ export abstract class NextTitleControl extends Themable {
|
||||
|
||||
constructor(
|
||||
parent: HTMLElement,
|
||||
protected accessor: INextEditorGroupsAccessor,
|
||||
protected group: INextEditorGroup,
|
||||
protected accessor: IEditorGroupsAccessor,
|
||||
protected group: IEditorGroup,
|
||||
@IContextMenuService private contextMenuService: IContextMenuService,
|
||||
@IInstantiationService protected instantiationService: IInstantiationService,
|
||||
@IContextKeyService private contextKeyService: IContextKeyService,
|
||||
@@ -310,7 +310,7 @@ export abstract class NextTitleControl extends Themable {
|
||||
return keybinding ? keybinding.getLabel() : void 0;
|
||||
}
|
||||
|
||||
//#region INextTitleAreaControl
|
||||
//#region ITitleAreaControl
|
||||
|
||||
abstract openEditor(editor: IEditorInput): void;
|
||||
|
||||
@@ -330,7 +330,7 @@ export abstract class NextTitleControl extends Themable {
|
||||
|
||||
abstract updateEditorDirty(editor: IEditorInput): void;
|
||||
|
||||
abstract updateOptions(oldOptions: INextEditorPartOptions, newOptions: INextEditorPartOptions): void;
|
||||
abstract updateOptions(oldOptions: IEditorPartOptions, newOptions: IEditorPartOptions): void;
|
||||
|
||||
abstract updateStyles(): void;
|
||||
|
||||
@@ -18,7 +18,7 @@ import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { ITextModel } from 'vs/editor/common/model';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { LRUCache } from 'vs/base/common/map';
|
||||
import { INextEditorGroupsService, INextEditorGroup } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { INextEditorGroupsService, IEditorGroup } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { ICompositeControl } from 'vs/workbench/common/composite';
|
||||
|
||||
export const EditorsVisibleContext = new RawContextKey<boolean>('editorIsOpen', false);
|
||||
@@ -54,7 +54,7 @@ export interface IEditor {
|
||||
/**
|
||||
* The assigned group this editor is showing in.
|
||||
*/
|
||||
group: INextEditorGroup;
|
||||
group: IEditorGroup;
|
||||
|
||||
/**
|
||||
* Returns the unique identifier of this editor.
|
||||
@@ -999,9 +999,9 @@ export class EditorViewStateMemento<T> {
|
||||
private limit: number = 10
|
||||
) { }
|
||||
|
||||
public saveState(group: INextEditorGroup, resource: URI, state: T): void;
|
||||
public saveState(group: INextEditorGroup, editor: EditorInput, state: T): void;
|
||||
public saveState(group: INextEditorGroup, resourceOrEditor: URI | EditorInput, state: T): void {
|
||||
public saveState(group: IEditorGroup, resource: URI, state: T): void;
|
||||
public saveState(group: IEditorGroup, editor: EditorInput, state: T): void;
|
||||
public saveState(group: IEditorGroup, resourceOrEditor: URI | EditorInput, state: T): void {
|
||||
const resource = this.doGetResource(resourceOrEditor);
|
||||
if (!resource || !group) {
|
||||
return; // we are not in a good state to save any viewstate for a resource
|
||||
@@ -1025,9 +1025,9 @@ export class EditorViewStateMemento<T> {
|
||||
}
|
||||
}
|
||||
|
||||
public loadState(group: INextEditorGroup, resource: URI): T;
|
||||
public loadState(group: INextEditorGroup, editor: EditorInput): T;
|
||||
public loadState(group: INextEditorGroup, resourceOrEditor: URI | EditorInput): T {
|
||||
public loadState(group: IEditorGroup, resource: URI): T;
|
||||
public loadState(group: IEditorGroup, editor: EditorInput): T;
|
||||
public loadState(group: IEditorGroup, resourceOrEditor: URI | EditorInput): T {
|
||||
const resource = this.doGetResource(resourceOrEditor);
|
||||
if (resource) {
|
||||
const cache = this.doLoad();
|
||||
@@ -1146,10 +1146,10 @@ export const Extensions = {
|
||||
|
||||
Registry.add(Extensions.EditorInputFactories, new EditorInputFactoryRegistry());
|
||||
|
||||
//#region obsolete
|
||||
//#region TODO@grid obsolete
|
||||
|
||||
export interface IStacksModelChangeEvent {
|
||||
group: IEditorGroup;
|
||||
group: ILegacyEditorGroup;
|
||||
editor?: IEditorInput;
|
||||
structural?: boolean;
|
||||
}
|
||||
@@ -1161,14 +1161,14 @@ export interface IEditorStacksModel {
|
||||
onWillCloseEditor: Event<IEditorCloseEvent>;
|
||||
onEditorClosed: Event<IEditorCloseEvent>;
|
||||
|
||||
groups: IEditorGroup[];
|
||||
activeGroup: IEditorGroup;
|
||||
isActive(group: IEditorGroup): boolean;
|
||||
groups: ILegacyEditorGroup[];
|
||||
activeGroup: ILegacyEditorGroup;
|
||||
isActive(group: ILegacyEditorGroup): boolean;
|
||||
|
||||
getGroup(id: GroupIdentifier): IEditorGroup;
|
||||
getGroup(id: GroupIdentifier): ILegacyEditorGroup;
|
||||
|
||||
positionOfGroup(group: IEditorGroup): Position;
|
||||
groupAt(position: Position): IEditorGroup;
|
||||
positionOfGroup(group: ILegacyEditorGroup): Position;
|
||||
groupAt(position: Position): ILegacyEditorGroup;
|
||||
|
||||
next(jumpGroups: boolean, cycleAtEnd?: boolean): IEditorIdentifier;
|
||||
previous(jumpGroups: boolean, cycleAtStart?: boolean): IEditorIdentifier;
|
||||
@@ -1179,7 +1179,7 @@ export interface IEditorStacksModel {
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
export interface IEditorGroup {
|
||||
export interface ILegacyEditorGroup {
|
||||
id: GroupIdentifier;
|
||||
count: number;
|
||||
activeEditor: IEditorInput;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
'use strict';
|
||||
|
||||
import { Event, Emitter, once } from 'vs/base/common/event';
|
||||
import { Extensions, IEditorInputFactoryRegistry, EditorInput, toResource, IEditorGroup, IEditorIdentifier, IEditorCloseEvent, GroupIdentifier, SideBySideEditorInput, CloseDirection } from 'vs/workbench/common/editor';
|
||||
import { Extensions, IEditorInputFactoryRegistry, EditorInput, toResource, ILegacyEditorGroup, IEditorIdentifier, IEditorCloseEvent, GroupIdentifier, SideBySideEditorInput, CloseDirection } from 'vs/workbench/common/editor';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IConfigurationService, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration';
|
||||
@@ -54,7 +54,7 @@ export function isSerializedEditorGroup(obj?: any): obj is ISerializedEditorGrou
|
||||
return obj && typeof obj === 'object' && Array.isArray(group.editors) && Array.isArray(group.mru);
|
||||
}
|
||||
|
||||
export class EditorGroup extends Disposable implements IEditorGroup {
|
||||
export class EditorGroup extends Disposable implements ILegacyEditorGroup {
|
||||
|
||||
private static IDS = 0;
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ import { SidebarPart } from 'vs/workbench/browser/parts/sidebar/sidebarPart';
|
||||
import { PanelPart } from 'vs/workbench/browser/parts/panel/panelPart';
|
||||
import { StatusbarPart } from 'vs/workbench/browser/parts/statusbar/statusbarPart';
|
||||
import { TitlebarPart } from 'vs/workbench/browser/parts/titlebar/titlebarPart';
|
||||
import { EditorPart } from 'vs/workbench/browser/parts/editor/editorPart';
|
||||
import { WorkbenchLayout } from 'vs/workbench/browser/layout';
|
||||
import { IActionBarRegistry, Extensions as ActionBarExtensions } from 'vs/workbench/browser/actions';
|
||||
import { PanelRegistry, Extensions as PanelExtensions } from 'vs/workbench/browser/panel';
|
||||
@@ -109,7 +110,6 @@ import { registerWindowDriver } from 'vs/platform/driver/electron-browser/driver
|
||||
import { IPreferencesService } from 'vs/workbench/services/preferences/common/preferences';
|
||||
import { PreferencesService } from 'vs/workbench/services/preferences/browser/preferencesService';
|
||||
import { INextEditorService } from 'vs/workbench/services/editor/common/nextEditorService';
|
||||
import { NextEditorPart } from 'vs/workbench/browser/parts/editor/nextEditorPart';
|
||||
import { INextEditorGroupsService, GroupDirection } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { NextEditorService } from 'vs/workbench/services/editor/browser/nextEditorService';
|
||||
import { IExtensionUrlHandler, ExtensionUrlHandler } from 'vs/platform/url/electron-browser/inactiveExtensionUrlHandler';
|
||||
@@ -205,7 +205,7 @@ export class Workbench extends Disposable implements IPartService {
|
||||
private activitybarPart: ActivitybarPart;
|
||||
private sidebarPart: SidebarPart;
|
||||
private panelPart: PanelPart;
|
||||
private editorPart: NextEditorPart;
|
||||
private editorPart: EditorPart;
|
||||
private statusbarPart: StatusbarPart;
|
||||
private quickOpen: QuickOpenController;
|
||||
private notificationsCenter: NotificationsCenter;
|
||||
@@ -380,7 +380,7 @@ export class Workbench extends Disposable implements IPartService {
|
||||
|
||||
// Editor and Group services
|
||||
const restorePreviousEditorState = !this.hasInitialFilesToOpen;
|
||||
this.editorPart = this.instantiationService.createInstance(NextEditorPart, Identifiers.EDITOR_PART, restorePreviousEditorState);
|
||||
this.editorPart = this.instantiationService.createInstance(EditorPart, Identifiers.EDITOR_PART, restorePreviousEditorState);
|
||||
this._register(toDisposable(() => this.editorPart.shutdown()));
|
||||
this.editorGroupService = this.editorPart;
|
||||
serviceCollection.set(INextEditorGroupsService, this.editorPart);
|
||||
|
||||
@@ -28,7 +28,7 @@ import { SideBySideEditor } from 'vs/workbench/browser/parts/editor/sideBySideEd
|
||||
import { IWindowService } from 'vs/platform/windows/common/windows';
|
||||
import { BINARY_FILE_EDITOR_ID } from 'vs/workbench/parts/files/common/files';
|
||||
import { INextEditorService } from 'vs/workbench/services/editor/common/nextEditorService';
|
||||
import { INextEditorGroupsService, INextEditorGroup } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { INextEditorGroupsService, IEditorGroup } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
|
||||
export class FileEditorTracker implements IWorkbenchContribution {
|
||||
|
||||
@@ -265,7 +265,7 @@ export class FileEditorTracker implements IWorkbenchContribution {
|
||||
return path.indexOf(candidate);
|
||||
}
|
||||
|
||||
private getViewStateFor(resource: URI, group: INextEditorGroup): IEditorViewState | undefined {
|
||||
private getViewStateFor(resource: URI, group: IEditorGroup): IEditorViewState | undefined {
|
||||
const editors = this.editorService.visibleControls;
|
||||
|
||||
for (let i = 0; i < editors.length; i++) {
|
||||
|
||||
@@ -30,7 +30,7 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { ScrollType } from 'vs/editor/common/editorCommon';
|
||||
import { IWindowsService } from 'vs/platform/windows/common/windows';
|
||||
import { INextEditorService } from 'vs/workbench/services/editor/common/nextEditorService';
|
||||
import { INextEditorGroupsService, INextEditorGroup } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { INextEditorGroupsService, IEditorGroup } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
|
||||
/**
|
||||
@@ -76,7 +76,7 @@ export class TextFileEditor extends BaseTextEditor {
|
||||
return this._input as FileEditorInput;
|
||||
}
|
||||
|
||||
setEditorVisible(visible: boolean, group: INextEditorGroup): void {
|
||||
setEditorVisible(visible: boolean, group: IEditorGroup): void {
|
||||
super.setEditorVisible(visible, group);
|
||||
|
||||
// React to editors closing to preserve view state. This needs to happen
|
||||
|
||||
@@ -17,7 +17,7 @@ import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { getPathLabel } from 'vs/base/common/labels';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { startsWith, startsWithIgnoreCase, rtrim } from 'vs/base/common/strings';
|
||||
import { INextEditorGroup } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { IEditorGroup } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
|
||||
export class Model {
|
||||
|
||||
@@ -452,7 +452,7 @@ export class NewStatPlaceholder extends ExplorerItem {
|
||||
|
||||
export class OpenEditor implements IEditorIdentifier {
|
||||
|
||||
constructor(private _editor: IEditorInput, private _group: INextEditorGroup) {
|
||||
constructor(private _editor: IEditorInput, private _group: IEditorGroup) {
|
||||
// noop
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
|
||||
import { IPartService } from 'vs/workbench/services/part/common/partService';
|
||||
import { DelegatingWorkbenchEditorService } from 'vs/workbench/services/editor/browser/nextEditorService';
|
||||
import { INextEditorGroup, INextEditorGroupsService } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { IEditorGroup, INextEditorGroupsService } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { INextEditorService } from 'vs/workbench/services/editor/common/nextEditorService';
|
||||
import { IEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
import { IEditorInput } from 'vs/workbench/common/editor';
|
||||
@@ -190,7 +190,7 @@ export class ExplorerViewlet extends PersistentViewsViewlet implements IExplorer
|
||||
// We try to be smart and only use the delay if we recognize that the user action is likely to cause
|
||||
// a new entry in the opened editors view.
|
||||
const delegatingEditorService = this.instantiationService.createInstance(DelegatingWorkbenchEditorService);
|
||||
delegatingEditorService.setEditorOpenHandler((group: INextEditorGroup, editor: IEditorInput, options?: IEditorOptions) => {
|
||||
delegatingEditorService.setEditorOpenHandler((group: IEditorGroup, editor: IEditorInput, options?: IEditorOptions) => {
|
||||
let openEditorsView = this.getOpenEditorsView();
|
||||
if (openEditorsView) {
|
||||
let delay = 0;
|
||||
|
||||
@@ -10,7 +10,7 @@ import { IAction } from 'vs/base/common/actions';
|
||||
import * as dom from 'vs/base/browser/dom';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { INextEditorGroupsService, INextEditorGroup, GroupChangeKind } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { INextEditorGroupsService, IEditorGroup, GroupChangeKind } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { IConfigurationService, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { IEditorInput } from 'vs/workbench/common/editor';
|
||||
@@ -51,7 +51,7 @@ export class OpenEditorsView extends ViewsViewletPanel {
|
||||
private dirtyCountElement: HTMLElement;
|
||||
private listRefreshScheduler: RunOnceScheduler;
|
||||
private structuralRefreshDelay: number;
|
||||
private list: WorkbenchList<OpenEditor | INextEditorGroup>;
|
||||
private list: WorkbenchList<OpenEditor | IEditorGroup>;
|
||||
private contributedContextMenu: IMenu;
|
||||
private needsRefresh: boolean;
|
||||
private resourceContext: ResourceContextKey;
|
||||
@@ -113,7 +113,7 @@ export class OpenEditorsView extends ViewsViewletPanel {
|
||||
};
|
||||
|
||||
const groupDisposables = new Map<number, IDisposable>();
|
||||
const addGroupListener = (group: INextEditorGroup) => {
|
||||
const addGroupListener = (group: IEditorGroup) => {
|
||||
groupDisposables.set(group.id, group.onDidGroupChange(e => {
|
||||
if (this.listRefreshScheduler.isScheduled()) {
|
||||
return;
|
||||
@@ -214,9 +214,9 @@ export class OpenEditorsView extends ViewsViewletPanel {
|
||||
new EditorGroupRenderer(this.keybindingService, this.instantiationService, this.editorGroupService),
|
||||
new OpenEditorRenderer(getSelectedElements, this.instantiationService, this.keybindingService, this.configurationService, this.editorGroupService)
|
||||
], {
|
||||
identityProvider: (element: OpenEditor | INextEditorGroup) => element instanceof OpenEditor ? element.getId() : element.id.toString(),
|
||||
identityProvider: (element: OpenEditor | IEditorGroup) => element instanceof OpenEditor ? element.getId() : element.id.toString(),
|
||||
selectOnMouseDown: false /* disabled to better support DND */
|
||||
}) as WorkbenchList<OpenEditor | INextEditorGroup>;
|
||||
}) as WorkbenchList<OpenEditor | IEditorGroup>;
|
||||
|
||||
this.contributedContextMenu = this.menuService.createMenu(MenuId.OpenEditorsContext, this.list.contextKeyService);
|
||||
this.disposables.push(this.contributedContextMenu);
|
||||
@@ -302,7 +302,7 @@ export class OpenEditorsView extends ViewsViewletPanel {
|
||||
this.list.domFocus();
|
||||
}
|
||||
|
||||
public getList(): WorkbenchList<OpenEditor | INextEditorGroup> {
|
||||
public getList(): WorkbenchList<OpenEditor | IEditorGroup> {
|
||||
return this.list;
|
||||
}
|
||||
|
||||
@@ -316,8 +316,8 @@ export class OpenEditorsView extends ViewsViewletPanel {
|
||||
return this.editorGroupService.groups.length > 1;
|
||||
}
|
||||
|
||||
private get elements(): (INextEditorGroup | OpenEditor)[] {
|
||||
const result: (INextEditorGroup | OpenEditor)[] = [];
|
||||
private get elements(): (IEditorGroup | OpenEditor)[] {
|
||||
const result: (IEditorGroup | OpenEditor)[] = [];
|
||||
this.editorGroupService.groups.forEach(g => {
|
||||
if (this.showGroups) {
|
||||
result.push(g);
|
||||
@@ -328,7 +328,7 @@ export class OpenEditorsView extends ViewsViewletPanel {
|
||||
return result;
|
||||
}
|
||||
|
||||
private getIndex(group: INextEditorGroup, editor: IEditorInput): number {
|
||||
private getIndex(group: IEditorGroup, editor: IEditorInput): number {
|
||||
let index = editor ? group.getIndexOfEditor(editor) : 0;
|
||||
if (!this.showGroups) {
|
||||
return index;
|
||||
@@ -367,7 +367,7 @@ export class OpenEditorsView extends ViewsViewletPanel {
|
||||
}
|
||||
}
|
||||
|
||||
private onListContextMenu(e: IListContextMenuEvent<OpenEditor | INextEditorGroup>): void {
|
||||
private onListContextMenu(e: IListContextMenuEvent<OpenEditor | IEditorGroup>): void {
|
||||
const element = e.element;
|
||||
this.contextMenuService.showContextMenu({
|
||||
getAnchor: () => e.anchor,
|
||||
@@ -464,19 +464,19 @@ interface IEditorGroupTemplateData {
|
||||
root: HTMLElement;
|
||||
name: HTMLSpanElement;
|
||||
actionBar: ActionBar;
|
||||
editorGroup: INextEditorGroup;
|
||||
editorGroup: IEditorGroup;
|
||||
toDispose: IDisposable[];
|
||||
}
|
||||
|
||||
class OpenEditorsDelegate implements IDelegate<OpenEditor | INextEditorGroup> {
|
||||
class OpenEditorsDelegate implements IDelegate<OpenEditor | IEditorGroup> {
|
||||
|
||||
public static readonly ITEM_HEIGHT = 22;
|
||||
|
||||
getHeight(element: OpenEditor | INextEditorGroup): number {
|
||||
getHeight(element: OpenEditor | IEditorGroup): number {
|
||||
return OpenEditorsDelegate.ITEM_HEIGHT;
|
||||
}
|
||||
|
||||
getTemplateId(element: OpenEditor | INextEditorGroup): string {
|
||||
getTemplateId(element: OpenEditor | IEditorGroup): string {
|
||||
if (element instanceof OpenEditor) {
|
||||
return OpenEditorRenderer.ID;
|
||||
}
|
||||
@@ -485,7 +485,7 @@ class OpenEditorsDelegate implements IDelegate<OpenEditor | INextEditorGroup> {
|
||||
}
|
||||
}
|
||||
|
||||
class EditorGroupRenderer implements IRenderer<INextEditorGroup, IEditorGroupTemplateData> {
|
||||
class EditorGroupRenderer implements IRenderer<IEditorGroup, IEditorGroupTemplateData> {
|
||||
static readonly ID = 'editorgroup';
|
||||
|
||||
private transfer = LocalSelectionTransfer.getInstance<OpenEditor>();
|
||||
@@ -536,7 +536,7 @@ class EditorGroupRenderer implements IRenderer<INextEditorGroup, IEditorGroupTem
|
||||
return editorGroupTemplate;
|
||||
}
|
||||
|
||||
renderElement(editorGroup: INextEditorGroup, index: number, templateData: IEditorGroupTemplateData): void {
|
||||
renderElement(editorGroup: IEditorGroup, index: number, templateData: IEditorGroupTemplateData): void {
|
||||
templateData.editorGroup = editorGroup;
|
||||
templateData.name.textContent = editorGroup.label;
|
||||
templateData.actionBar.context = { groupId: editorGroup.id };
|
||||
@@ -554,7 +554,7 @@ class OpenEditorRenderer implements IRenderer<OpenEditor, IOpenEditorTemplateDat
|
||||
private transfer = LocalSelectionTransfer.getInstance<OpenEditor>();
|
||||
|
||||
constructor(
|
||||
private getSelectedElements: () => (OpenEditor | INextEditorGroup)[],
|
||||
private getSelectedElements: () => (OpenEditor | IEditorGroup)[],
|
||||
private instantiationService: IInstantiationService,
|
||||
private keybindingService: IKeybindingService,
|
||||
private configurationService: IConfigurationService,
|
||||
|
||||
@@ -24,7 +24,7 @@ import { Dimension } from 'vs/base/browser/dom';
|
||||
import { BaseWebviewEditor } from 'vs/workbench/parts/webview/electron-browser/baseWebviewEditor';
|
||||
import { WebviewElement, WebviewOptions } from 'vs/workbench/parts/webview/electron-browser/webviewElement';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { INextEditorGroupsService, INextEditorGroup } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { INextEditorGroupsService, IEditorGroup } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
|
||||
export interface HtmlPreviewEditorViewState {
|
||||
@@ -123,7 +123,7 @@ export class HtmlPreviewPart extends BaseWebviewEditor {
|
||||
return this._webview;
|
||||
}
|
||||
|
||||
protected setEditorVisible(visible: boolean, group: INextEditorGroup): void {
|
||||
protected setEditorVisible(visible: boolean, group: IEditorGroup): void {
|
||||
this._doSetVisible(visible);
|
||||
super.setEditorVisible(visible, group);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ import { IProgressService } from 'vs/platform/progress/common/progress';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { PreferencesEditorInput, DefaultPreferencesEditorInput } from 'vs/workbench/services/preferences/common/preferencesEditorInput';
|
||||
import { PREFERENCES_EDITOR_ID } from 'vs/workbench/parts/files/common/files';
|
||||
import { INextEditorGroupsService, INextEditorGroup } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { INextEditorGroupsService, IEditorGroup } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { INextEditorService } from 'vs/workbench/services/editor/common/nextEditorService';
|
||||
|
||||
@@ -192,7 +192,7 @@ export class PreferencesEditor extends BaseEditor {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected setEditorVisible(visible: boolean, group: INextEditorGroup): void {
|
||||
protected setEditorVisible(visible: boolean, group: IEditorGroup): void {
|
||||
this.sideBySidePreferencesWidget.setEditorVisible(visible, group);
|
||||
super.setEditorVisible(visible, group);
|
||||
}
|
||||
@@ -861,7 +861,7 @@ class SideBySidePreferencesWidget extends Widget {
|
||||
}
|
||||
}
|
||||
|
||||
public setEditorVisible(visible: boolean, group: INextEditorGroup): void {
|
||||
public setEditorVisible(visible: boolean, group: IEditorGroup): void {
|
||||
if (this.defaultPreferencesEditor) {
|
||||
this.defaultPreferencesEditor.setVisible(visible, group);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ import { IPreferencesService, FOLDER_SETTINGS_PATH, DEFAULT_SETTINGS_EDITOR_SETT
|
||||
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { INextEditorService, IOpenEditorOverride } from 'vs/workbench/services/editor/common/nextEditorService';
|
||||
import { IEditorOptions, ITextEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
import { INextEditorGroup } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { IEditorGroup } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { endsWith } from 'vs/base/common/strings';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { IEditorInput } from 'vs/workbench/common/editor';
|
||||
@@ -61,7 +61,7 @@ export class PreferencesContribution implements IWorkbenchContribution {
|
||||
}
|
||||
}
|
||||
|
||||
private onEditorOpening(editor: IEditorInput, options: IEditorOptions | ITextEditorOptions, group: INextEditorGroup): IOpenEditorOverride {
|
||||
private onEditorOpening(editor: IEditorInput, options: IEditorOptions | ITextEditorOptions, group: IEditorGroup): IOpenEditorOverride {
|
||||
const resource = editor.getResource();
|
||||
if (
|
||||
!resource || resource.scheme !== 'file' || // require a file path opening
|
||||
|
||||
@@ -21,7 +21,7 @@ import { themeColorFromId } from 'vs/platform/theme/common/themeService';
|
||||
import { IEditorOptions, RenderLineNumbersType } from 'vs/editor/common/config/editorOptions';
|
||||
import { INextEditorService, SIDE_GROUP } from 'vs/workbench/services/editor/common/nextEditorService';
|
||||
import { isCodeEditor, isDiffEditor } from 'vs/editor/browser/editorBrowser';
|
||||
import { INextEditorGroup } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { IEditorGroup } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
|
||||
export const GOTO_LINE_PREFIX = ':';
|
||||
|
||||
@@ -239,7 +239,7 @@ export class GotoLineHandler extends QuickOpenHandler {
|
||||
return canRun ? true : nls.localize('cannotRunGotoLine', "Open a text file first to go to a line");
|
||||
}
|
||||
|
||||
public decorateOutline(range: IRange, editor: IEditor, group: INextEditorGroup): void {
|
||||
public decorateOutline(range: IRange, editor: IEditor, group: IEditorGroup): void {
|
||||
editor.changeDecorations(changeAccessor => {
|
||||
const deleteDecorations: string[] = [];
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import { themeColorFromId } from 'vs/platform/theme/common/themeService';
|
||||
import { overviewRulerRangeHighlight } from 'vs/editor/common/view/editorColorRegistry';
|
||||
import { GroupIdentifier, IEditorInput } from 'vs/workbench/common/editor';
|
||||
import { INextEditorService, SIDE_GROUP } from 'vs/workbench/services/editor/common/nextEditorService';
|
||||
import { INextEditorGroup } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { IEditorGroup } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
|
||||
export const GOTO_SYMBOL_PREFIX = '@';
|
||||
export const SCOPE_PREFIX = ':';
|
||||
@@ -507,7 +507,7 @@ export class GotoSymbolHandler extends QuickOpenHandler {
|
||||
return TPromise.wrap<OutlineModel>(null);
|
||||
}
|
||||
|
||||
public decorateOutline(fullRange: IRange, startRange: IRange, editor: IEditor, group: INextEditorGroup): void {
|
||||
public decorateOutline(fullRange: IRange, startRange: IRange, editor: IEditor, group: IEditorGroup): void {
|
||||
editor.changeDecorations((changeAccessor: IModelDecorationsChangeAccessor) => {
|
||||
const deleteDecorations: string[] = [];
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { EditorOptions } from 'vs/workbench/common/editor';
|
||||
import { INextEditorGroup } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { IEditorGroup } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { WebviewEditorInput } from 'vs/workbench/parts/webview/electron-browser/webviewEditorInput';
|
||||
import { IPartService, Parts } from 'vs/workbench/services/part/common/partService';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
@@ -100,7 +100,7 @@ export class WebviewEditor extends BaseWebviewEditor {
|
||||
return this._onDidFocusWebview.event;
|
||||
}
|
||||
|
||||
protected setEditorVisible(visible: boolean, group: INextEditorGroup): void {
|
||||
protected setEditorVisible(visible: boolean, group: IEditorGroup): void {
|
||||
if (this.input && this.input instanceof WebviewEditorInput) {
|
||||
if (visible) {
|
||||
this.input.claimWebview(this);
|
||||
|
||||
@@ -24,7 +24,7 @@ import { basename } from 'vs/base/common/paths';
|
||||
import { DiffEditorInput } from 'vs/workbench/common/editor/diffEditorInput';
|
||||
import { localize } from 'vs/nls';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { INextEditorGroupsService, INextEditorGroup, GroupsOrder, IEditorReplacement, GroupChangeKind, preferredGroupDirection } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { INextEditorGroupsService, IEditorGroup, GroupsOrder, IEditorReplacement, GroupChangeKind, preferredGroupDirection } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { INextEditorService, IResourceEditor, ACTIVE_GROUP_TYPE, SIDE_GROUP_TYPE, SIDE_GROUP, ACTIVE_GROUP, IResourceEditorReplacement, IOpenEditorOverrideHandler } from 'vs/workbench/services/editor/common/nextEditorService';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { Disposable, IDisposable, dispose, toDisposable } from 'vs/base/common/lifecycle';
|
||||
@@ -82,7 +82,7 @@ export class NextEditorService extends Disposable implements INextEditorService
|
||||
this.editorGroupService.onDidAddGroup(group => this.registerGroupListeners(group));
|
||||
}
|
||||
|
||||
private handleActiveEditorChange(group: INextEditorGroup): void {
|
||||
private handleActiveEditorChange(group: IEditorGroup): void {
|
||||
if (group !== this.editorGroupService.activeGroup) {
|
||||
return; // ignore if not the active group
|
||||
}
|
||||
@@ -96,7 +96,7 @@ export class NextEditorService extends Disposable implements INextEditorService
|
||||
this._onDidActiveEditorChange.fire();
|
||||
}
|
||||
|
||||
private registerGroupListeners(group: INextEditorGroup): void {
|
||||
private registerGroupListeners(group: IEditorGroup): void {
|
||||
const groupDisposeables: IDisposable[] = [];
|
||||
|
||||
groupDisposeables.push(group.onDidGroupChange(e => {
|
||||
@@ -123,7 +123,7 @@ export class NextEditorService extends Disposable implements INextEditorService
|
||||
});
|
||||
}
|
||||
|
||||
private onGroupWillOpenEditor(group: INextEditorGroup, event: IEditorOpeningEvent): void {
|
||||
private onGroupWillOpenEditor(group: IEditorGroup, event: IEditorOpeningEvent): void {
|
||||
for (let i = 0; i < this.openEditorHandlers.length; i++) {
|
||||
const handler = this.openEditorHandlers[i];
|
||||
const result = handler(event.editor, event.options, group);
|
||||
@@ -217,9 +217,9 @@ export class NextEditorService extends Disposable implements INextEditorService
|
||||
|
||||
//#region openEditor()
|
||||
|
||||
openEditor(editor: IEditorInput, options?: IEditorOptions | ITextEditorOptions, group?: INextEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): TPromise<IEditor>;
|
||||
openEditor(editor: IResourceEditor, group?: INextEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): TPromise<IEditor>;
|
||||
openEditor(editor: IEditorInput | IResourceEditor, optionsOrGroup?: IEditorOptions | ITextEditorOptions | INextEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE, group?: GroupIdentifier): TPromise<IEditor> {
|
||||
openEditor(editor: IEditorInput, options?: IEditorOptions | ITextEditorOptions, group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): TPromise<IEditor>;
|
||||
openEditor(editor: IResourceEditor, group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): TPromise<IEditor>;
|
||||
openEditor(editor: IEditorInput | IResourceEditor, optionsOrGroup?: IEditorOptions | ITextEditorOptions | IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE, group?: GroupIdentifier): TPromise<IEditor> {
|
||||
|
||||
// Typed Editor Support
|
||||
if (editor instanceof EditorInput) {
|
||||
@@ -243,7 +243,7 @@ export class NextEditorService extends Disposable implements INextEditorService
|
||||
const typedInput = this.createInput(textInput);
|
||||
if (typedInput) {
|
||||
const editorOptions = TextEditorOptions.from(textInput);
|
||||
const targetGroup = this.findTargetGroup(typedInput, editorOptions, optionsOrGroup as INextEditorGroup | GroupIdentifier);
|
||||
const targetGroup = this.findTargetGroup(typedInput, editorOptions, optionsOrGroup as IEditorGroup | GroupIdentifier);
|
||||
|
||||
return this.doOpenEditor(targetGroup, typedInput, editorOptions);
|
||||
}
|
||||
@@ -251,12 +251,12 @@ export class NextEditorService extends Disposable implements INextEditorService
|
||||
return TPromise.wrap<IEditor>(null);
|
||||
}
|
||||
|
||||
protected doOpenEditor(group: INextEditorGroup, editor: IEditorInput, options?: IEditorOptions): TPromise<IEditor> {
|
||||
protected doOpenEditor(group: IEditorGroup, editor: IEditorInput, options?: IEditorOptions): TPromise<IEditor> {
|
||||
return group.openEditor(editor, options).then(() => group.activeControl);
|
||||
}
|
||||
|
||||
private findTargetGroup(input: IEditorInput, options?: IEditorOptions, group?: INextEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): INextEditorGroup {
|
||||
let targetGroup: INextEditorGroup;
|
||||
private findTargetGroup(input: IEditorInput, options?: IEditorOptions, group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): IEditorGroup {
|
||||
let targetGroup: IEditorGroup;
|
||||
|
||||
// Group: Instance of Group
|
||||
if (group && typeof group !== 'number') {
|
||||
@@ -313,7 +313,7 @@ export class NextEditorService extends Disposable implements INextEditorService
|
||||
return targetGroup;
|
||||
}
|
||||
|
||||
private findSideBySideGroup(): INextEditorGroup {
|
||||
private findSideBySideGroup(): IEditorGroup {
|
||||
const direction = preferredGroupDirection(this.configurationService);
|
||||
|
||||
let neighbourGroup = this.editorGroupService.findGroup({ direction });
|
||||
@@ -341,9 +341,9 @@ export class NextEditorService extends Disposable implements INextEditorService
|
||||
|
||||
//#region openEditors()
|
||||
|
||||
openEditors(editors: IEditorInputWithOptions[], group?: INextEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): TPromise<IEditor[]>;
|
||||
openEditors(editors: IResourceEditor[], group?: INextEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): TPromise<IEditor[]>;
|
||||
openEditors(editors: (IEditorInputWithOptions | IResourceEditor)[], group?: INextEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): TPromise<IEditor[]> {
|
||||
openEditors(editors: IEditorInputWithOptions[], group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): TPromise<IEditor[]>;
|
||||
openEditors(editors: IResourceEditor[], group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): TPromise<IEditor[]>;
|
||||
openEditors(editors: (IEditorInputWithOptions | IResourceEditor)[], group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): TPromise<IEditor[]> {
|
||||
|
||||
// Convert to typed editors and options
|
||||
const typedEditors: IEditorInputWithOptions[] = [];
|
||||
@@ -356,7 +356,7 @@ export class NextEditorService extends Disposable implements INextEditorService
|
||||
});
|
||||
|
||||
// Find target groups to open
|
||||
const mapGroupToEditors = new Map<INextEditorGroup, IEditorInputWithOptions[]>();
|
||||
const mapGroupToEditors = new Map<IEditorGroup, IEditorInputWithOptions[]>();
|
||||
if (group === SIDE_GROUP) {
|
||||
mapGroupToEditors.set(this.findSideBySideGroup(), typedEditors);
|
||||
} else {
|
||||
@@ -386,8 +386,8 @@ export class NextEditorService extends Disposable implements INextEditorService
|
||||
|
||||
//#region isOpen()
|
||||
|
||||
isOpen(editor: IEditorInput | IResourceInput | IUntitledResourceInput, group?: INextEditorGroup | GroupIdentifier): boolean {
|
||||
let groups: INextEditorGroup[] = [];
|
||||
isOpen(editor: IEditorInput | IResourceInput | IUntitledResourceInput, group?: IEditorGroup | GroupIdentifier): boolean {
|
||||
let groups: IEditorGroup[] = [];
|
||||
if (typeof group === 'number') {
|
||||
groups.push(this.editorGroupService.getGroup(group));
|
||||
} else if (group) {
|
||||
@@ -418,9 +418,9 @@ export class NextEditorService extends Disposable implements INextEditorService
|
||||
|
||||
//#region replaceEditors()
|
||||
|
||||
replaceEditors(editors: IResourceEditorReplacement[], group: INextEditorGroup | GroupIdentifier): TPromise<void>;
|
||||
replaceEditors(editors: IEditorReplacement[], group: INextEditorGroup | GroupIdentifier): TPromise<void>;
|
||||
replaceEditors(editors: (IEditorReplacement | IResourceEditorReplacement)[], group: INextEditorGroup | GroupIdentifier): TPromise<void> {
|
||||
replaceEditors(editors: IResourceEditorReplacement[], group: IEditorGroup | GroupIdentifier): TPromise<void>;
|
||||
replaceEditors(editors: IEditorReplacement[], group: IEditorGroup | GroupIdentifier): TPromise<void>;
|
||||
replaceEditors(editors: (IEditorReplacement | IResourceEditorReplacement)[], group: IEditorGroup | GroupIdentifier): TPromise<void> {
|
||||
const typedEditors: IEditorReplacement[] = [];
|
||||
|
||||
editors.forEach(replaceEditorArg => {
|
||||
@@ -581,7 +581,7 @@ export class NextEditorService extends Disposable implements INextEditorService
|
||||
}
|
||||
|
||||
export interface IEditorOpenHandler {
|
||||
(group: INextEditorGroup, editor: IEditorInput, options?: IEditorOptions | ITextEditorOptions): TPromise<IEditor>;
|
||||
(group: IEditorGroup, editor: IEditorInput, options?: IEditorOptions | ITextEditorOptions): TPromise<IEditor>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -615,7 +615,7 @@ export class DelegatingWorkbenchEditorService extends NextEditorService {
|
||||
this.editorOpenHandler = handler;
|
||||
}
|
||||
|
||||
protected doOpenEditor(group: INextEditorGroup, editor: IEditorInput, options?: IEditorOptions): TPromise<IEditor> {
|
||||
protected doOpenEditor(group: IEditorGroup, editor: IEditorInput, options?: IEditorOptions): TPromise<IEditor> {
|
||||
const handleOpen = this.editorOpenHandler ? this.editorOpenHandler(group, editor, options) : TPromise.as(void 0);
|
||||
|
||||
return handleOpen.then(control => {
|
||||
|
||||
@@ -11,7 +11,7 @@ import { IEditorOptions, ITextEditorOptions, Position, IResourceInput } from 'vs
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { basename } from 'vs/base/common/paths';
|
||||
import { EditorInput, EditorOptions, TextEditorOptions, Extensions as EditorExtensions, IResourceDiffInput, IResourceSideBySideInput, IUntitledResourceInput, SideBySideEditorInput, IFileEditorInput, IFileInputFactory, IEditorInputFactoryRegistry, IEditorStacksModel, IEditorOpeningEvent, IEditorGroup, IStacksModelChangeEvent, IEditorCloseEvent, IEditorIdentifier, CloseDirection, IEditor, IEditorInput } from 'vs/workbench/common/editor';
|
||||
import { EditorInput, EditorOptions, TextEditorOptions, Extensions as EditorExtensions, IResourceDiffInput, IResourceSideBySideInput, IUntitledResourceInput, SideBySideEditorInput, IFileEditorInput, IFileInputFactory, IEditorInputFactoryRegistry, IEditorStacksModel, IEditorOpeningEvent, ILegacyEditorGroup, IStacksModelChangeEvent, IEditorCloseEvent, IEditorIdentifier, CloseDirection, IEditor, IEditorInput } from 'vs/workbench/common/editor';
|
||||
import { ResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorInput';
|
||||
import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
|
||||
import { DiffEditorInput } from 'vs/workbench/common/editor/diffEditorInput';
|
||||
@@ -236,22 +236,22 @@ export class NoOpEditorStacksModel implements IEditorStacksModel {
|
||||
onWillCloseEditor: Event<IEditorCloseEvent> = new Emitter<IEditorCloseEvent>().event;
|
||||
onEditorClosed: Event<IEditorCloseEvent> = new Emitter<IEditorCloseEvent>().event;
|
||||
|
||||
groups: IEditorGroup[] = [];
|
||||
activeGroup: IEditorGroup;
|
||||
groups: ILegacyEditorGroup[] = [];
|
||||
activeGroup: ILegacyEditorGroup;
|
||||
|
||||
isActive(group: IEditorGroup): boolean {
|
||||
isActive(group: ILegacyEditorGroup): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
getGroup(id: number): IEditorGroup {
|
||||
getGroup(id: number): ILegacyEditorGroup {
|
||||
return null;
|
||||
}
|
||||
|
||||
positionOfGroup(group: IEditorGroup): Position {
|
||||
positionOfGroup(group: ILegacyEditorGroup): Position {
|
||||
return Position.ONE;
|
||||
}
|
||||
|
||||
groupAt(position: Position): IEditorGroup {
|
||||
groupAt(position: Position): ILegacyEditorGroup {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import { IResourceInput, IEditorOptions, ITextEditorOptions } from 'vs/platform/
|
||||
import { IEditorInput, IEditor, GroupIdentifier, IEditorInputWithOptions, IEditorIdentifier, IUntitledResourceInput, IResourceDiffInput, IResourceSideBySideInput, IEditorCloseEvent } from 'vs/workbench/common/editor';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { IEditor as ITextEditor } from 'vs/editor/common/editorCommon';
|
||||
import { INextEditorGroup, IEditorReplacement } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { IEditorGroup, IEditorReplacement } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
|
||||
@@ -30,7 +30,7 @@ export const SIDE_GROUP = -2;
|
||||
export type SIDE_GROUP_TYPE = typeof SIDE_GROUP;
|
||||
|
||||
export interface IOpenEditorOverrideHandler {
|
||||
(editor: IEditorInput, options: IEditorOptions | ITextEditorOptions, group: INextEditorGroup): IOpenEditorOverride;
|
||||
(editor: IEditorInput, options: IEditorOptions | ITextEditorOptions, group: IEditorGroup): IOpenEditorOverride;
|
||||
}
|
||||
|
||||
export interface IOpenEditorOverride {
|
||||
@@ -78,7 +78,7 @@ export interface INextEditorService {
|
||||
readonly activeTextEditorControl: ITextEditor;
|
||||
|
||||
/**
|
||||
* All editors that are opened.
|
||||
* All editors that are opened.
|
||||
*/
|
||||
readonly editors: ReadonlyArray<IEditorInput>;
|
||||
|
||||
@@ -112,7 +112,7 @@ export interface INextEditorService {
|
||||
* active group. Use `SIDE_GROUP_TYPE` to open the editor in a new editor group to the side
|
||||
* of the currently active group.
|
||||
*/
|
||||
openEditor(editor: IEditorInput, options?: IEditorOptions | ITextEditorOptions, group?: INextEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): TPromise<IEditor>;
|
||||
openEditor(editor: IEditorInput, options?: IEditorOptions | ITextEditorOptions, group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): TPromise<IEditor>;
|
||||
|
||||
/**
|
||||
* Open an editor in an editor group.
|
||||
@@ -122,7 +122,7 @@ export interface INextEditorService {
|
||||
* active group. Use `SIDE_GROUP_TYPE` to open the editor in a new editor group to the side
|
||||
* of the currently active group.
|
||||
*/
|
||||
openEditor(editor: IResourceEditor, group?: INextEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): TPromise<IEditor>;
|
||||
openEditor(editor: IResourceEditor, group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): TPromise<IEditor>;
|
||||
|
||||
/**
|
||||
* Open editors in an editor group.
|
||||
@@ -132,8 +132,8 @@ export interface INextEditorService {
|
||||
* active group. Use `SIDE_GROUP_TYPE` to open the editor in a new editor group to the side
|
||||
* of the currently active group.
|
||||
*/
|
||||
openEditors(editors: IEditorInputWithOptions[], group?: INextEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): TPromise<ReadonlyArray<IEditor>>;
|
||||
openEditors(editors: IResourceEditor[], group?: INextEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): TPromise<ReadonlyArray<IEditor>>;
|
||||
openEditors(editors: IEditorInputWithOptions[], group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): TPromise<ReadonlyArray<IEditor>>;
|
||||
openEditors(editors: IResourceEditor[], group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): TPromise<ReadonlyArray<IEditor>>;
|
||||
|
||||
/**
|
||||
* Replaces editors in an editor group with the provided replacement.
|
||||
@@ -143,8 +143,8 @@ export interface INextEditorService {
|
||||
* @returns a promise that is resolved when the replaced active
|
||||
* editor (if any) has finished loading.
|
||||
*/
|
||||
replaceEditors(editors: IResourceEditorReplacement[], group: INextEditorGroup | GroupIdentifier): TPromise<void>;
|
||||
replaceEditors(editors: IEditorReplacement[], group: INextEditorGroup | GroupIdentifier): TPromise<void>;
|
||||
replaceEditors(editors: IResourceEditorReplacement[], group: IEditorGroup | GroupIdentifier): TPromise<void>;
|
||||
replaceEditors(editors: IEditorReplacement[], group: IEditorGroup | GroupIdentifier): TPromise<void>;
|
||||
|
||||
/**
|
||||
* Find out if the provided editor (or resource of an editor) is opened in any or
|
||||
@@ -154,7 +154,7 @@ export interface INextEditorService {
|
||||
*
|
||||
* @param group optional to specify a group to check for the editor being opened
|
||||
*/
|
||||
isOpen(editor: IEditorInput | IResourceInput | IUntitledResourceInput, group?: INextEditorGroup | GroupIdentifier): boolean;
|
||||
isOpen(editor: IEditorInput | IResourceInput | IUntitledResourceInput, group?: IEditorGroup | GroupIdentifier): boolean;
|
||||
|
||||
/**
|
||||
* Allows to override the opening of editors by installing a handler that will
|
||||
|
||||
@@ -16,8 +16,8 @@ import { workbenchInstantiationService } from 'vs/workbench/test/workbenchTestSe
|
||||
import { ResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorInput';
|
||||
import { TestThemeService } from 'vs/platform/theme/test/common/testThemeService';
|
||||
import { NextEditorService, DelegatingWorkbenchEditorService } from 'vs/workbench/services/editor/browser/nextEditorService';
|
||||
import { INextEditorGroup, INextEditorGroupsService, GroupDirection } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { NextEditorPart } from 'vs/workbench/browser/parts/editor/nextEditorPart';
|
||||
import { IEditorGroup, INextEditorGroupsService, GroupDirection } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { EditorPart } from 'vs/workbench/browser/parts/editor/editorPart';
|
||||
import { Dimension } from 'vs/base/browser/dom';
|
||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||
import { INextEditorService, SIDE_GROUP } from 'vs/workbench/services/editor/common/nextEditorService';
|
||||
@@ -68,7 +68,7 @@ suite('Editor service', () => {
|
||||
test('basics', function () {
|
||||
const partInstantiator = workbenchInstantiationService();
|
||||
|
||||
const part = partInstantiator.createInstance(NextEditorPart, 'id', false);
|
||||
const part = partInstantiator.createInstance(EditorPart, 'id', false);
|
||||
part.create(document.createElement('div'));
|
||||
part.layout(new Dimension(400, 300));
|
||||
|
||||
@@ -136,7 +136,7 @@ suite('Editor service', () => {
|
||||
test('openEditors() / replaceEditors()', function () {
|
||||
const partInstantiator = workbenchInstantiationService();
|
||||
|
||||
const part = partInstantiator.createInstance(NextEditorPart, 'id', false);
|
||||
const part = partInstantiator.createInstance(EditorPart, 'id', false);
|
||||
part.create(document.createElement('div'));
|
||||
part.layout(new Dimension(400, 300));
|
||||
|
||||
@@ -260,7 +260,7 @@ suite('Editor service', () => {
|
||||
|
||||
const inp = instantiationService.createInstance(ResourceEditorInput, 'name', 'description', URI.parse('my://resource'));
|
||||
const delegate = instantiationService.createInstance(DelegatingWorkbenchEditorService);
|
||||
delegate.setEditorOpenHandler((group: INextEditorGroup, input: IEditorInput, options?: EditorOptions) => {
|
||||
delegate.setEditorOpenHandler((group: IEditorGroup, input: IEditorInput, options?: EditorOptions) => {
|
||||
assert.strictEqual(input, inp);
|
||||
|
||||
done();
|
||||
@@ -274,7 +274,7 @@ suite('Editor service', () => {
|
||||
test('close editor does not dispose when editor opened in other group', function () {
|
||||
const partInstantiator = workbenchInstantiationService();
|
||||
|
||||
const part = partInstantiator.createInstance(NextEditorPart, 'id', false);
|
||||
const part = partInstantiator.createInstance(EditorPart, 'id', false);
|
||||
part.create(document.createElement('div'));
|
||||
part.layout(new Dimension(400, 300));
|
||||
|
||||
@@ -310,7 +310,7 @@ suite('Editor service', () => {
|
||||
test('close editor does not dispose when editor opened in other group (diff input)', function () {
|
||||
const partInstantiator = workbenchInstantiationService();
|
||||
|
||||
const part = partInstantiator.createInstance(NextEditorPart, 'id', false);
|
||||
const part = partInstantiator.createInstance(EditorPart, 'id', false);
|
||||
part.create(document.createElement('div'));
|
||||
part.layout(new Dimension(400, 300));
|
||||
|
||||
@@ -348,7 +348,7 @@ suite('Editor service', () => {
|
||||
test('close editor disposes properly (diff input)', function () {
|
||||
const partInstantiator = workbenchInstantiationService();
|
||||
|
||||
const part = partInstantiator.createInstance(NextEditorPart, 'id', false);
|
||||
const part = partInstantiator.createInstance(EditorPart, 'id', false);
|
||||
part.create(document.createElement('div'));
|
||||
part.layout(new Dimension(400, 300));
|
||||
|
||||
@@ -375,7 +375,7 @@ suite('Editor service', () => {
|
||||
test('close editor disposes properly (diff input, left side still opened)', function () {
|
||||
const partInstantiator = workbenchInstantiationService();
|
||||
|
||||
const part = partInstantiator.createInstance(NextEditorPart, 'id', false);
|
||||
const part = partInstantiator.createInstance(EditorPart, 'id', false);
|
||||
part.create(document.createElement('div'));
|
||||
part.layout(new Dimension(400, 300));
|
||||
|
||||
@@ -404,7 +404,7 @@ suite('Editor service', () => {
|
||||
test('open to the side', function () {
|
||||
const partInstantiator = workbenchInstantiationService();
|
||||
|
||||
const part = partInstantiator.createInstance(NextEditorPart, 'id', false);
|
||||
const part = partInstantiator.createInstance(EditorPart, 'id', false);
|
||||
part.create(document.createElement('div'));
|
||||
part.layout(new Dimension(400, 300));
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
import { createDecorator, ServiceIdentifier, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { Position } from 'vs/platform/editor/common/editor';
|
||||
import { IEditorStacksModel, IEditorGroup, IEditorOpeningEvent, IEditorInput } from 'vs/workbench/common/editor';
|
||||
import { IEditorStacksModel, ILegacyEditorGroup, IEditorOpeningEvent, IEditorInput } from 'vs/workbench/common/editor';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
|
||||
export enum GroupArrangement {
|
||||
@@ -75,19 +75,19 @@ export interface IEditorGroupService {
|
||||
/**
|
||||
* Keyboard focus the editor group at the provided position.
|
||||
*/
|
||||
focusGroup(group: IEditorGroup): void;
|
||||
focusGroup(group: ILegacyEditorGroup): void;
|
||||
focusGroup(position: Position): void;
|
||||
|
||||
/**
|
||||
* Activate the editor group at the provided position without moving focus.
|
||||
*/
|
||||
activateGroup(group: IEditorGroup): void;
|
||||
activateGroup(group: ILegacyEditorGroup): void;
|
||||
activateGroup(position: Position): void;
|
||||
|
||||
/**
|
||||
* Allows to move the editor group from one position to another.
|
||||
*/
|
||||
moveGroup(from: IEditorGroup, to: IEditorGroup): void;
|
||||
moveGroup(from: ILegacyEditorGroup, to: ILegacyEditorGroup): void;
|
||||
moveGroup(from: Position, to: Position): void;
|
||||
|
||||
/**
|
||||
@@ -114,14 +114,14 @@ export interface IEditorGroupService {
|
||||
/**
|
||||
* Adds the pinned state to an editor, removing it from being a preview editor.
|
||||
*/
|
||||
pinEditor(group: IEditorGroup, input: IEditorInput): void;
|
||||
pinEditor(group: ILegacyEditorGroup, input: IEditorInput): void;
|
||||
pinEditor(position: Position, input: IEditorInput): void;
|
||||
|
||||
/**
|
||||
* Moves an editor from one group to another. The index in the group is optional.
|
||||
* The inactive option is applied when moving across groups.
|
||||
*/
|
||||
moveEditor(input: IEditorInput, from: IEditorGroup, to: IEditorGroup, moveOptions?: IMoveOptions): void;
|
||||
moveEditor(input: IEditorInput, from: ILegacyEditorGroup, to: ILegacyEditorGroup, moveOptions?: IMoveOptions): void;
|
||||
moveEditor(input: IEditorInput, from: Position, to: Position, moveOptions?: IMoveOptions): void;
|
||||
|
||||
/**
|
||||
|
||||
@@ -136,33 +136,33 @@ export interface INextEditorGroupsService {
|
||||
* An event for when the active editor group changes. The active editor
|
||||
* group is the default location for new editors to open.
|
||||
*/
|
||||
readonly onDidActiveGroupChange: Event<INextEditorGroup>;
|
||||
readonly onDidActiveGroupChange: Event<IEditorGroup>;
|
||||
|
||||
/**
|
||||
* An event for when a new group was added.
|
||||
*/
|
||||
readonly onDidAddGroup: Event<INextEditorGroup>;
|
||||
readonly onDidAddGroup: Event<IEditorGroup>;
|
||||
|
||||
/**
|
||||
* An event for when a group was removed.
|
||||
*/
|
||||
readonly onDidRemoveGroup: Event<INextEditorGroup>;
|
||||
readonly onDidRemoveGroup: Event<IEditorGroup>;
|
||||
|
||||
/**
|
||||
* An event for when a group was moved.
|
||||
*/
|
||||
readonly onDidMoveGroup: Event<INextEditorGroup>;
|
||||
readonly onDidMoveGroup: Event<IEditorGroup>;
|
||||
|
||||
/**
|
||||
* An active group is the default location for new editors to open.
|
||||
*/
|
||||
readonly activeGroup: INextEditorGroup;
|
||||
readonly activeGroup: IEditorGroup;
|
||||
|
||||
/**
|
||||
* All groups that are currently visible in the editor area in the
|
||||
* order of their creation (oldest first).
|
||||
*/
|
||||
readonly groups: ReadonlyArray<INextEditorGroup>;
|
||||
readonly groups: ReadonlyArray<IEditorGroup>;
|
||||
|
||||
/**
|
||||
* The number of editor groups that are currently opened.
|
||||
@@ -184,27 +184,27 @@ export interface INextEditorGroupsService {
|
||||
* sorted by being most recent active or grid order. Will sort by creation
|
||||
* time by default (oldest group first).
|
||||
*/
|
||||
getGroups(order?: GroupsOrder): ReadonlyArray<INextEditorGroup>;
|
||||
getGroups(order?: GroupsOrder): ReadonlyArray<IEditorGroup>;
|
||||
|
||||
/**
|
||||
* Allows to convert a group identifier to a group.
|
||||
*/
|
||||
getGroup(identifier: GroupIdentifier): INextEditorGroup;
|
||||
getGroup(identifier: GroupIdentifier): IEditorGroup;
|
||||
|
||||
/**
|
||||
* Move keyboard focus into the provided group.
|
||||
*/
|
||||
focusGroup(group: INextEditorGroup | GroupIdentifier): INextEditorGroup;
|
||||
focusGroup(group: IEditorGroup | GroupIdentifier): IEditorGroup;
|
||||
|
||||
/**
|
||||
* Set a group as active. An active group is the default location for new editors to open.
|
||||
*/
|
||||
activateGroup(group: INextEditorGroup | GroupIdentifier): INextEditorGroup;
|
||||
activateGroup(group: IEditorGroup | GroupIdentifier): IEditorGroup;
|
||||
|
||||
/**
|
||||
* Resize the group given the provided size delta.
|
||||
*/
|
||||
resizeGroup(group: INextEditorGroup | GroupIdentifier, sizeDelta: number): INextEditorGroup;
|
||||
resizeGroup(group: IEditorGroup | GroupIdentifier, sizeDelta: number): IEditorGroup;
|
||||
|
||||
/**
|
||||
* Arrange all groups according to the provided arrangement.
|
||||
@@ -230,7 +230,7 @@ export interface INextEditorGroupsService {
|
||||
* @param scope the scope of the group to search in
|
||||
* @param source optional source to search from
|
||||
*/
|
||||
findGroup(scope: IFindGroupScope, source?: INextEditorGroup | GroupIdentifier): INextEditorGroup;
|
||||
findGroup(scope: IFindGroupScope, source?: IEditorGroup | GroupIdentifier): IEditorGroup;
|
||||
|
||||
/**
|
||||
* Add a new group to the editor area. A new group is added by splitting a provided one in
|
||||
@@ -240,12 +240,12 @@ export interface INextEditorGroupsService {
|
||||
* @param direction the direction of where to split to
|
||||
* @param options configure the newly group with options
|
||||
*/
|
||||
addGroup(location: INextEditorGroup | GroupIdentifier, direction: GroupDirection, options?: IAddGroupOptions): INextEditorGroup;
|
||||
addGroup(location: IEditorGroup | GroupIdentifier, direction: GroupDirection, options?: IAddGroupOptions): IEditorGroup;
|
||||
|
||||
/**
|
||||
* Remove a group from the editor area.
|
||||
*/
|
||||
removeGroup(group: INextEditorGroup | GroupIdentifier): void;
|
||||
removeGroup(group: IEditorGroup | GroupIdentifier): void;
|
||||
|
||||
/**
|
||||
* Move a group to a new group in the editor area.
|
||||
@@ -254,7 +254,7 @@ export interface INextEditorGroupsService {
|
||||
* @param location the group from which to split to add the moved group
|
||||
* @param direction the direction of where to split to
|
||||
*/
|
||||
moveGroup(group: INextEditorGroup | GroupIdentifier, location: INextEditorGroup | GroupIdentifier, direction: GroupDirection): INextEditorGroup;
|
||||
moveGroup(group: IEditorGroup | GroupIdentifier, location: IEditorGroup | GroupIdentifier, direction: GroupDirection): IEditorGroup;
|
||||
|
||||
/**
|
||||
* Merge the editors of a group into a target group. By default, all editors will
|
||||
@@ -268,7 +268,7 @@ export interface INextEditorGroupsService {
|
||||
* `MOVE_EDITORS_KEEP_GROUP` to prevent the source group from closing. Set to
|
||||
* `COPY_EDITORS` to copy the editors into the target instead of moding them.
|
||||
*/
|
||||
mergeGroup(group: INextEditorGroup | GroupIdentifier, target: INextEditorGroup | GroupIdentifier, options?: IMergeGroupOptions): INextEditorGroup;
|
||||
mergeGroup(group: IEditorGroup | GroupIdentifier, target: IEditorGroup | GroupIdentifier, options?: IMergeGroupOptions): IEditorGroup;
|
||||
|
||||
/**
|
||||
* Copy a group to a new group in the editor area.
|
||||
@@ -277,7 +277,7 @@ export interface INextEditorGroupsService {
|
||||
* @param location the group from which to split to add the copied group
|
||||
* @param direction the direction of where to split to
|
||||
*/
|
||||
copyGroup(group: INextEditorGroup | GroupIdentifier, location: INextEditorGroup | GroupIdentifier, direction: GroupDirection): INextEditorGroup;
|
||||
copyGroup(group: IEditorGroup | GroupIdentifier, location: IEditorGroup | GroupIdentifier, direction: GroupDirection): IEditorGroup;
|
||||
}
|
||||
|
||||
export enum GroupChangeKind {
|
||||
@@ -302,7 +302,7 @@ export interface IGroupChangeEvent {
|
||||
editorIndex?: number;
|
||||
}
|
||||
|
||||
export interface INextEditorGroup {
|
||||
export interface IEditorGroup {
|
||||
|
||||
/**
|
||||
* A unique identifier of this group that remains identical even if the
|
||||
@@ -431,14 +431,14 @@ export interface INextEditorGroup {
|
||||
/**
|
||||
* Move an editor from this group either within this group or to another group.
|
||||
*/
|
||||
moveEditor(editor: IEditorInput, target: INextEditorGroup, options?: IMoveEditorOptions): void;
|
||||
moveEditor(editor: IEditorInput, target: IEditorGroup, options?: IMoveEditorOptions): void;
|
||||
|
||||
/**
|
||||
* Copy an editor from this group to another group.
|
||||
*
|
||||
* Note: It is currently not supported to show the same editor more than once in the same group.
|
||||
*/
|
||||
copyEditor(editor: IEditorInput, target: INextEditorGroup, options?: ICopyEditorOptions): void;
|
||||
copyEditor(editor: IEditorInput, target: IEditorGroup, options?: ICopyEditorOptions): void;
|
||||
|
||||
/**
|
||||
* Close an editor from the group. This may trigger a confirmation dialog if
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { NextEditorPart } from 'vs/workbench/browser/parts/editor/nextEditorPart';
|
||||
import { EditorPart } from 'vs/workbench/browser/parts/editor/editorPart';
|
||||
import { workbenchInstantiationService } from 'vs/workbench/test/workbenchTestServices';
|
||||
import { GroupDirection, GroupsOrder, MergeGroupMode, GroupOrientation, GroupChangeKind, EditorsOrder, GroupLocation } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { Dimension } from 'vs/base/browser/dom';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { INextEditorPartOptions } from 'vs/workbench/browser/parts/editor/editor';
|
||||
import { IEditorPartOptions } from 'vs/workbench/browser/parts/editor/editor';
|
||||
import { EditorInput, IFileEditorInput, IEditorInputFactory, IEditorInputFactoryRegistry, Extensions as EditorExtensions, EditorOptions, CloseDirection } from 'vs/workbench/common/editor';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IEditorModel } from 'vs/platform/editor/common/editor';
|
||||
@@ -26,9 +26,9 @@ import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
|
||||
export class TestEditorControl extends BaseEditor {
|
||||
|
||||
constructor(@ITelemetryService telemetryService: ITelemetryService) { super('MyFileEditorForNextEditorGroupService', NullTelemetryService, new TestThemeService()); }
|
||||
constructor(@ITelemetryService telemetryService: ITelemetryService) { super('MyFileEditorForEditorGroupService', NullTelemetryService, new TestThemeService()); }
|
||||
|
||||
getId(): string { return 'myTestEditorForNextEditorGroupService'; }
|
||||
getId(): string { return 'myTestEditorForEditorGroupService'; }
|
||||
layout(): void { }
|
||||
createEditor(): any { }
|
||||
}
|
||||
@@ -37,7 +37,7 @@ export class TestEditorInput extends EditorInput implements IFileEditorInput {
|
||||
|
||||
constructor(private resource: URI) { super(); }
|
||||
|
||||
getTypeId() { return 'testEditorInputForNextEditorGroupService'; }
|
||||
getTypeId() { return 'testEditorInputForEditorGroupService'; }
|
||||
resolve(): TPromise<IEditorModel> { return null; }
|
||||
matches(other: TestEditorInput): boolean { return other && this.resource.toString() === other.resource.toString() && other instanceof TestEditorInput; }
|
||||
setEncoding(encoding: string) { }
|
||||
@@ -81,10 +81,10 @@ suite('Editor groups service', () => {
|
||||
|
||||
registerTestEditorInput();
|
||||
|
||||
function createPart(): NextEditorPart {
|
||||
function createPart(): EditorPart {
|
||||
const instantiationService = workbenchInstantiationService();
|
||||
|
||||
const part = instantiationService.createInstance(NextEditorPart, 'id', false);
|
||||
const part = instantiationService.createInstance(EditorPart, 'id', false);
|
||||
part.create(document.createElement('div'));
|
||||
part.layout(new Dimension(400, 300));
|
||||
|
||||
@@ -349,8 +349,8 @@ suite('Editor groups service', () => {
|
||||
test('options', function () {
|
||||
const part = createPart();
|
||||
|
||||
let oldOptions: INextEditorPartOptions;
|
||||
let newOptions: INextEditorPartOptions;
|
||||
let oldOptions: IEditorPartOptions;
|
||||
let newOptions: IEditorPartOptions;
|
||||
part.onDidEditorPartOptionsChange(event => {
|
||||
oldOptions = event.oldPartOptions;
|
||||
newOptions = event.newPartOptions;
|
||||
|
||||
@@ -22,7 +22,7 @@ import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { once, debounceEvent } from 'vs/base/common/event';
|
||||
import { IConfigurationService, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration';
|
||||
import { INextEditorGroupsService, INextEditorGroup } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { INextEditorGroupsService, IEditorGroup } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { IWindowsService } from 'vs/platform/windows/common/windows';
|
||||
import { getCodeEditor } from 'vs/editor/browser/editorBrowser';
|
||||
import { getExcludes, ISearchConfiguration } from 'vs/platform/search/common/search';
|
||||
@@ -609,7 +609,7 @@ export class HistoryService implements IHistoryService {
|
||||
this.windowService.removeFromRecentlyOpened([input.resource.fsPath]);
|
||||
}
|
||||
|
||||
private isFileOpened(resource: URI, group: INextEditorGroup): boolean {
|
||||
private isFileOpened(resource: URI, group: IEditorGroup): boolean {
|
||||
if (!group) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ import { ICodeEditor, getCodeEditor } from 'vs/editor/browser/editorBrowser';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
import { INextEditorService, SIDE_GROUP } from 'vs/workbench/services/editor/common/nextEditorService';
|
||||
import { INextEditorGroup, INextEditorGroupsService } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { IEditorGroup, INextEditorGroupsService } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
|
||||
const emptyEditableSettingsContent = '{\n}';
|
||||
|
||||
@@ -182,7 +182,7 @@ export class PreferencesService extends Disposable implements IPreferencesServic
|
||||
return this.openOrSwitchSettings(target, resource);
|
||||
}
|
||||
|
||||
openGlobalSettings(options?: IEditorOptions, group?: INextEditorGroup): TPromise<IEditor> {
|
||||
openGlobalSettings(options?: IEditorOptions, group?: IEditorGroup): TPromise<IEditor> {
|
||||
return this.openOrSwitchSettings(ConfigurationTarget.USER, this.userSettingsResource, options, group);
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ export class PreferencesService extends Disposable implements IPreferencesServic
|
||||
return this.editorService.openEditor(this.instantiationService.createInstance(SettingsEditor2Input), { pinned: true }).then(() => null);
|
||||
}
|
||||
|
||||
openWorkspaceSettings(options?: IEditorOptions, group?: INextEditorGroup): TPromise<IEditor> {
|
||||
openWorkspaceSettings(options?: IEditorOptions, group?: IEditorGroup): TPromise<IEditor> {
|
||||
if (this.contextService.getWorkbenchState() === WorkbenchState.EMPTY) {
|
||||
this.notificationService.info(nls.localize('openFolderFirst', "Open a folder first to create workspace settings"));
|
||||
return TPromise.as(null);
|
||||
@@ -198,7 +198,7 @@ export class PreferencesService extends Disposable implements IPreferencesServic
|
||||
return this.openOrSwitchSettings(ConfigurationTarget.WORKSPACE, this.workspaceSettingsResource, options, group);
|
||||
}
|
||||
|
||||
openFolderSettings(folder: URI, options?: IEditorOptions, group?: INextEditorGroup): TPromise<IEditor> {
|
||||
openFolderSettings(folder: URI, options?: IEditorOptions, group?: IEditorGroup): TPromise<IEditor> {
|
||||
return this.openOrSwitchSettings(ConfigurationTarget.WORKSPACE_FOLDER, this.getEditableSettingsURI(ConfigurationTarget.WORKSPACE_FOLDER, folder), options, group);
|
||||
}
|
||||
|
||||
@@ -247,7 +247,7 @@ export class PreferencesService extends Disposable implements IPreferencesServic
|
||||
});
|
||||
}
|
||||
|
||||
private openOrSwitchSettings(configurationTarget: ConfigurationTarget, resource: URI, options?: IEditorOptions, group: INextEditorGroup = this.editorGroupService.activeGroup): TPromise<IEditor> {
|
||||
private openOrSwitchSettings(configurationTarget: ConfigurationTarget, resource: URI, options?: IEditorOptions, group: IEditorGroup = this.editorGroupService.activeGroup): TPromise<IEditor> {
|
||||
const editorInput = this.getActiveSettingsEditorInput(group);
|
||||
if (editorInput && editorInput.master.getResource().fsPath !== resource.fsPath) {
|
||||
return this.doSwitchSettings(configurationTarget, resource, editorInput, group);
|
||||
@@ -255,7 +255,7 @@ export class PreferencesService extends Disposable implements IPreferencesServic
|
||||
return this.doOpenSettings(configurationTarget, resource, options, group);
|
||||
}
|
||||
|
||||
private doOpenSettings(configurationTarget: ConfigurationTarget, resource: URI, options?: IEditorOptions, group?: INextEditorGroup): TPromise<IEditor> {
|
||||
private doOpenSettings(configurationTarget: ConfigurationTarget, resource: URI, options?: IEditorOptions, group?: IEditorGroup): TPromise<IEditor> {
|
||||
const openDefaultSettings = !!this.configurationService.getValue(DEFAULT_SETTINGS_EDITOR_SETTING);
|
||||
return this.getOrCreateEditableSettingsEditorInput(configurationTarget, resource)
|
||||
.then(editableSettingsEditorInput => {
|
||||
@@ -275,7 +275,7 @@ export class PreferencesService extends Disposable implements IPreferencesServic
|
||||
});
|
||||
}
|
||||
|
||||
private doSwitchSettings(target: ConfigurationTarget, resource: URI, input: PreferencesEditorInput, group: INextEditorGroup): TPromise<IEditor> {
|
||||
private doSwitchSettings(target: ConfigurationTarget, resource: URI, input: PreferencesEditorInput, group: IEditorGroup): TPromise<IEditor> {
|
||||
return this.getOrCreateEditableSettingsEditorInput(target, this.getEditableSettingsURI(target, resource))
|
||||
.then(toInput => {
|
||||
const replaceWith = new PreferencesEditorInput(this.getPreferencesEditorInputName(target, resource), toInput.getDescription(), this.instantiationService.createInstance(DefaultPreferencesEditorInput, this.getDefaultSettingsResource(target)), toInput);
|
||||
@@ -290,7 +290,7 @@ export class PreferencesService extends Disposable implements IPreferencesServic
|
||||
});
|
||||
}
|
||||
|
||||
private getActiveSettingsEditorInput(group: INextEditorGroup = this.editorGroupService.activeGroup): PreferencesEditorInput {
|
||||
private getActiveSettingsEditorInput(group: IEditorGroup = this.editorGroupService.activeGroup): PreferencesEditorInput {
|
||||
return <PreferencesEditorInput>group.editors.filter(e => e instanceof PreferencesEditorInput)[0];
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import { Event } from 'vs/base/common/event';
|
||||
import { IStringDictionary } from 'vs/base/common/collections';
|
||||
import { ILocalExtension } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { localize } from 'vs/nls';
|
||||
import { INextEditorGroup } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { IEditorGroup } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
|
||||
export interface ISettingsGroup {
|
||||
id: string;
|
||||
@@ -146,9 +146,9 @@ export interface IPreferencesService {
|
||||
openRawUserSettings(): TPromise<IEditor>;
|
||||
openSettings(): TPromise<IEditor>;
|
||||
openSettings2(): TPromise<IEditor>;
|
||||
openGlobalSettings(options?: IEditorOptions, group?: INextEditorGroup): TPromise<IEditor>;
|
||||
openWorkspaceSettings(options?: IEditorOptions, group?: INextEditorGroup): TPromise<IEditor>;
|
||||
openFolderSettings(folder: URI, options?: IEditorOptions, group?: INextEditorGroup): TPromise<IEditor>;
|
||||
openGlobalSettings(options?: IEditorOptions, group?: IEditorGroup): TPromise<IEditor>;
|
||||
openWorkspaceSettings(options?: IEditorOptions, group?: IEditorGroup): TPromise<IEditor>;
|
||||
openFolderSettings(folder: URI, options?: IEditorOptions, group?: IEditorGroup): TPromise<IEditor>;
|
||||
switchSettings(target: ConfigurationTarget, resource: URI): TPromise<void>;
|
||||
openGlobalKeybindingSettings(textual: boolean): TPromise<void>;
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import URI from 'vs/base/common/uri';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils';
|
||||
import { StorageService, InMemoryLocalStorage } from 'vs/platform/storage/common/storageService';
|
||||
import { IEditorGroup, ConfirmResult, IEditorOpeningEvent, IEditorInputWithOptions, CloseDirection, IEditorIdentifier, IUntitledResourceInput, IResourceDiffInput, IResourceSideBySideInput, IEditorInput, IEditor, IEditorCloseEvent } from 'vs/workbench/common/editor';
|
||||
import { ILegacyEditorGroup, ConfirmResult, IEditorOpeningEvent, IEditorInputWithOptions, CloseDirection, IEditorIdentifier, IUntitledResourceInput, IResourceDiffInput, IResourceSideBySideInput, IEditorInput, IEditor, IEditorCloseEvent } from 'vs/workbench/common/editor';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { IBackupFileService } from 'vs/workbench/services/backup/common/backup';
|
||||
@@ -68,7 +68,7 @@ import { IExtensionPoint } from 'vs/workbench/services/extensions/common/extensi
|
||||
import { IKeybindingService } from '../../platform/keybinding/common/keybinding';
|
||||
import { IDecorationsService, IResourceDecorationChangeEvent, IDecoration, IDecorationData, IDecorationsProvider } from 'vs/workbench/services/decorations/browser/decorations';
|
||||
import { IDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { INextEditorGroupsService, INextEditorGroup, GroupsOrder, GroupsArrangement, GroupDirection, IAddGroupOptions, IMergeGroupOptions, IMoveEditorOptions, ICopyEditorOptions, IEditorReplacement, IGroupChangeEvent, EditorsOrder, IFindGroupScope } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { INextEditorGroupsService, IEditorGroup, GroupsOrder, GroupsArrangement, GroupDirection, IAddGroupOptions, IMergeGroupOptions, IMoveEditorOptions, ICopyEditorOptions, IEditorReplacement, IGroupChangeEvent, EditorsOrder, IFindGroupScope } from 'vs/workbench/services/group/common/nextEditorGroupsService';
|
||||
import { INextEditorService, IOpenEditorOverrideHandler } from 'vs/workbench/services/editor/common/nextEditorService';
|
||||
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
|
||||
import { ICodeEditor, IDiffEditor } from 'vs/editor/browser/editorBrowser';
|
||||
@@ -557,19 +557,19 @@ export class TestEditorGroupService implements IEditorGroupService {
|
||||
return this._onTabOptionsChanged.event;
|
||||
}
|
||||
|
||||
public focusGroup(group: IEditorGroup): void;
|
||||
public focusGroup(group: ILegacyEditorGroup): void;
|
||||
public focusGroup(position: Position): void;
|
||||
public focusGroup(arg1: any): void {
|
||||
|
||||
}
|
||||
|
||||
public activateGroup(group: IEditorGroup): void;
|
||||
public activateGroup(group: ILegacyEditorGroup): void;
|
||||
public activateGroup(position: Position): void;
|
||||
public activateGroup(arg1: any): void {
|
||||
|
||||
}
|
||||
|
||||
public moveGroup(from: IEditorGroup, to: IEditorGroup): void;
|
||||
public moveGroup(from: ILegacyEditorGroup, to: ILegacyEditorGroup): void;
|
||||
public moveGroup(from: Position, to: Position): void;
|
||||
public moveGroup(arg1: any, arg2: any): void {
|
||||
|
||||
@@ -591,12 +591,12 @@ export class TestEditorGroupService implements IEditorGroupService {
|
||||
|
||||
}
|
||||
|
||||
public pinEditor(group: IEditorGroup, input: IEditorInput): void;
|
||||
public pinEditor(group: ILegacyEditorGroup, input: IEditorInput): void;
|
||||
public pinEditor(position: Position, input: IEditorInput): void;
|
||||
public pinEditor(arg1: any, input: IEditorInput): void {
|
||||
}
|
||||
|
||||
public moveEditor(input: IEditorInput, from: IEditorGroup, to: IEditorGroup, moveOptions?: IMoveOptions): void;
|
||||
public moveEditor(input: IEditorInput, from: ILegacyEditorGroup, to: ILegacyEditorGroup, moveOptions?: IMoveOptions): void;
|
||||
public moveEditor(input: IEditorInput, from: Position, to: Position, moveOptions?: IMoveOptions): void;
|
||||
public moveEditor(input: IEditorInput, from: any, to: any, moveOptions?: IMoveOptions): void {
|
||||
}
|
||||
@@ -705,15 +705,15 @@ export class TestNextEditorGroupsService implements INextEditorGroupsService {
|
||||
|
||||
constructor(public groups: TestNextEditorGroup[] = []) { }
|
||||
|
||||
onDidActiveGroupChange: Event<INextEditorGroup> = Event.None;
|
||||
onDidAddGroup: Event<INextEditorGroup> = Event.None;
|
||||
onDidRemoveGroup: Event<INextEditorGroup> = Event.None;
|
||||
onDidMoveGroup: Event<INextEditorGroup> = Event.None;
|
||||
onDidActiveGroupChange: Event<IEditorGroup> = Event.None;
|
||||
onDidAddGroup: Event<IEditorGroup> = Event.None;
|
||||
onDidRemoveGroup: Event<IEditorGroup> = Event.None;
|
||||
onDidMoveGroup: Event<IEditorGroup> = Event.None;
|
||||
|
||||
orientation: any;
|
||||
whenRestored: TPromise<void> = TPromise.as(void 0);
|
||||
|
||||
get activeGroup(): INextEditorGroup {
|
||||
get activeGroup(): IEditorGroup {
|
||||
return this.groups[0];
|
||||
}
|
||||
|
||||
@@ -721,11 +721,11 @@ export class TestNextEditorGroupsService implements INextEditorGroupsService {
|
||||
return this.groups.length;
|
||||
}
|
||||
|
||||
getGroups(order?: GroupsOrder): ReadonlyArray<INextEditorGroup> {
|
||||
getGroups(order?: GroupsOrder): ReadonlyArray<IEditorGroup> {
|
||||
return this.groups;
|
||||
}
|
||||
|
||||
getGroup(identifier: number): INextEditorGroup {
|
||||
getGroup(identifier: number): IEditorGroup {
|
||||
for (let i = 0; i < this.groups.length; i++) {
|
||||
if (this.groups[i].id === identifier) {
|
||||
return this.groups[i];
|
||||
@@ -739,19 +739,19 @@ export class TestNextEditorGroupsService implements INextEditorGroupsService {
|
||||
return 'Group 1';
|
||||
}
|
||||
|
||||
focusGroup(group: number | INextEditorGroup): INextEditorGroup {
|
||||
focusGroup(group: number | IEditorGroup): IEditorGroup {
|
||||
return null;
|
||||
}
|
||||
|
||||
findGroup(scope: IFindGroupScope, source?: number | INextEditorGroup): INextEditorGroup {
|
||||
findGroup(scope: IFindGroupScope, source?: number | IEditorGroup): IEditorGroup {
|
||||
return null;
|
||||
}
|
||||
|
||||
activateGroup(group: number | INextEditorGroup): INextEditorGroup {
|
||||
activateGroup(group: number | IEditorGroup): IEditorGroup {
|
||||
return null;
|
||||
}
|
||||
|
||||
resizeGroup(group: number | INextEditorGroup, sizeDelta: number): INextEditorGroup {
|
||||
resizeGroup(group: number | IEditorGroup, sizeDelta: number): IEditorGroup {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -759,26 +759,26 @@ export class TestNextEditorGroupsService implements INextEditorGroupsService {
|
||||
|
||||
setGroupOrientation(orientation: any): void { }
|
||||
|
||||
addGroup(location: number | INextEditorGroup, direction: GroupDirection, options?: IAddGroupOptions): INextEditorGroup {
|
||||
addGroup(location: number | IEditorGroup, direction: GroupDirection, options?: IAddGroupOptions): IEditorGroup {
|
||||
return null;
|
||||
}
|
||||
|
||||
removeGroup(group: number | INextEditorGroup): void { }
|
||||
removeGroup(group: number | IEditorGroup): void { }
|
||||
|
||||
moveGroup(group: number | INextEditorGroup, location: number | INextEditorGroup, direction: GroupDirection): INextEditorGroup {
|
||||
moveGroup(group: number | IEditorGroup, location: number | IEditorGroup, direction: GroupDirection): IEditorGroup {
|
||||
return null;
|
||||
}
|
||||
|
||||
mergeGroup(group: number | INextEditorGroup, target: number | INextEditorGroup, options?: IMergeGroupOptions): INextEditorGroup {
|
||||
mergeGroup(group: number | IEditorGroup, target: number | IEditorGroup, options?: IMergeGroupOptions): IEditorGroup {
|
||||
return null;
|
||||
}
|
||||
|
||||
copyGroup(group: number | INextEditorGroup, location: number | INextEditorGroup, direction: GroupDirection): INextEditorGroup {
|
||||
copyGroup(group: number | IEditorGroup, location: number | IEditorGroup, direction: GroupDirection): IEditorGroup {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export class TestNextEditorGroup implements INextEditorGroup {
|
||||
export class TestNextEditorGroup implements IEditorGroup {
|
||||
|
||||
constructor(public id: number) { }
|
||||
|
||||
@@ -828,9 +828,9 @@ export class TestNextEditorGroup implements INextEditorGroup {
|
||||
return false;
|
||||
}
|
||||
|
||||
moveEditor(editor: IEditorInput, target: INextEditorGroup, options?: IMoveEditorOptions): void { }
|
||||
moveEditor(editor: IEditorInput, target: IEditorGroup, options?: IMoveEditorOptions): void { }
|
||||
|
||||
copyEditor(editor: IEditorInput, target: INextEditorGroup, options?: ICopyEditorOptions): void { }
|
||||
copyEditor(editor: IEditorInput, target: IEditorGroup, options?: ICopyEditorOptions): void { }
|
||||
|
||||
closeEditor(editor?: IEditorInput): TPromise<void> {
|
||||
return TPromise.as(void 0);
|
||||
|
||||
Reference in New Issue
Block a user