@codingame/monaco-vscode-a8d3bd74-e63e-5327-96e8-4f931661e329-common 18.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/empty.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export {}
|
package/package.json
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
{
|
2
|
+
"name": "@codingame/monaco-vscode-a8d3bd74-e63e-5327-96e8-4f931661e329-common",
|
3
|
+
"version": "18.0.0",
|
4
|
+
"private": false,
|
5
|
+
"description": "VSCode public API plugged on the monaco editor - common package (bulk-edit, chat, debug, edit-sessions, explorer, extension-gallery, extensions, markers, mcp, outline, output, remote-agent, scm, search, terminal, testing, timeline, user-data-sync, view-common, views, workbench)",
|
6
|
+
"keywords": [],
|
7
|
+
"author": {
|
8
|
+
"name": "CodinGame",
|
9
|
+
"url": "http://www.codingame.com"
|
10
|
+
},
|
11
|
+
"license": "MIT",
|
12
|
+
"repository": {
|
13
|
+
"type": "git",
|
14
|
+
"url": "git+ssh://git@github.com/CodinGame/monaco-vscode-api.git"
|
15
|
+
},
|
16
|
+
"type": "module",
|
17
|
+
"dependencies": {
|
18
|
+
"@codingame/monaco-vscode-501b06ab-3f58-516b-8a1a-c29d375d3da4-common": "18.0.0",
|
19
|
+
"@codingame/monaco-vscode-924e8f00-6faf-5059-b518-e43427d29ab3-common": "18.0.0",
|
20
|
+
"@codingame/monaco-vscode-api": "18.0.0"
|
21
|
+
},
|
22
|
+
"exports": {
|
23
|
+
".": {
|
24
|
+
"default": "./empty.js"
|
25
|
+
},
|
26
|
+
"./vscode/*.css": {
|
27
|
+
"default": "./vscode/src/*.css"
|
28
|
+
},
|
29
|
+
"./vscode/*": {
|
30
|
+
"types": "./vscode/src/*.d.ts",
|
31
|
+
"default": "./vscode/src/*.js"
|
32
|
+
},
|
33
|
+
"./*": {
|
34
|
+
"types": "./*.d.ts",
|
35
|
+
"default": "./*.js"
|
36
|
+
}
|
37
|
+
},
|
38
|
+
"typesVersions": {
|
39
|
+
"*": {
|
40
|
+
"vscode/*": [
|
41
|
+
"./vscode/src/*.d.ts"
|
42
|
+
]
|
43
|
+
}
|
44
|
+
}
|
45
|
+
}
|
@@ -0,0 +1,127 @@
|
|
1
|
+
import { Dimension } from "@codingame/monaco-vscode-api/vscode/vs/base/browser/dom";
|
2
|
+
import { IActionViewItem } from "@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/actionbar/actionbar";
|
3
|
+
import { IBoundarySashes } from "@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/sash/sash";
|
4
|
+
import { IPaneViewOptions } from "@codingame/monaco-vscode-501b06ab-3f58-516b-8a1a-c29d375d3da4-common/vscode/vs/base/browser/ui/splitview/paneview";
|
5
|
+
import { IAction } from "@codingame/monaco-vscode-api/vscode/vs/base/common/actions";
|
6
|
+
import { Event } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event";
|
7
|
+
import { IDisposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
8
|
+
import { Action2, IAction2Options, MenuId } from "@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions";
|
9
|
+
import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
|
10
|
+
import { IContextMenuService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextview/browser/contextView.service";
|
11
|
+
import { IInstantiationService, ServicesAccessor } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
12
|
+
import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service";
|
13
|
+
import { ITelemetryService } from "@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service";
|
14
|
+
import { IThemeService } from "@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service";
|
15
|
+
import { IWorkspaceContextService } from "@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service";
|
16
|
+
import { CompositeMenuActions } from "@codingame/monaco-vscode-501b06ab-3f58-516b-8a1a-c29d375d3da4-common/vscode/vs/workbench/browser/actions";
|
17
|
+
import { ViewPane } from "@codingame/monaco-vscode-501b06ab-3f58-516b-8a1a-c29d375d3da4-common/vscode/vs/workbench/browser/parts/views/viewPane";
|
18
|
+
import { IViewletViewOptions } from "@codingame/monaco-vscode-2a94c04a-b85b-5669-b06b-89c1bfa11cb9-common/vscode/vs/workbench/browser/parts/views/viewsViewlet";
|
19
|
+
import { Component } from "@codingame/monaco-vscode-924e8f00-6faf-5059-b518-e43427d29ab3-common/vscode/vs/workbench/common/component";
|
20
|
+
import { IAddedViewDescriptorRef, IView, IViewContainerModel, IViewDescriptor, IViewPaneContainer, ViewContainer } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/views";
|
21
|
+
import { IViewDescriptorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/views.service";
|
22
|
+
import { IExtensionService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions.service";
|
23
|
+
import { IWorkbenchLayoutService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/layout/browser/layoutService.service";
|
24
|
+
import { IBaseActionViewItemOptions } from "@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/actionbar/actionViewItems";
|
25
|
+
import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
|
26
|
+
export declare const ViewsSubMenu: MenuId;
|
27
|
+
export interface IViewPaneContainerOptions extends IPaneViewOptions {
|
28
|
+
mergeViewWithContainerWhenSingleView: boolean;
|
29
|
+
}
|
30
|
+
export declare class ViewPaneContainer extends Component implements IViewPaneContainer {
|
31
|
+
private options;
|
32
|
+
protected instantiationService: IInstantiationService;
|
33
|
+
protected configurationService: IConfigurationService;
|
34
|
+
protected layoutService: IWorkbenchLayoutService;
|
35
|
+
protected contextMenuService: IContextMenuService;
|
36
|
+
protected telemetryService: ITelemetryService;
|
37
|
+
protected extensionService: IExtensionService;
|
38
|
+
protected storageService: IStorageService;
|
39
|
+
protected contextService: IWorkspaceContextService;
|
40
|
+
protected viewDescriptorService: IViewDescriptorService;
|
41
|
+
protected readonly logService: ILogService;
|
42
|
+
readonly viewContainer: ViewContainer;
|
43
|
+
private lastFocusedPane;
|
44
|
+
private lastMergedCollapsedPane;
|
45
|
+
private paneItems;
|
46
|
+
private paneview?;
|
47
|
+
private visible;
|
48
|
+
private areExtensionsReady;
|
49
|
+
private didLayout;
|
50
|
+
private dimension;
|
51
|
+
private _boundarySashes;
|
52
|
+
private readonly visibleViewsCountFromCache;
|
53
|
+
private readonly visibleViewsStorageId;
|
54
|
+
protected readonly viewContainerModel: IViewContainerModel;
|
55
|
+
private readonly _onTitleAreaUpdate;
|
56
|
+
readonly onTitleAreaUpdate: Event<void>;
|
57
|
+
private readonly _onDidChangeVisibility;
|
58
|
+
readonly onDidChangeVisibility: Event<boolean>;
|
59
|
+
private readonly _onDidAddViews;
|
60
|
+
readonly onDidAddViews: Event<IView[]>;
|
61
|
+
private readonly _onDidRemoveViews;
|
62
|
+
readonly onDidRemoveViews: Event<IView[]>;
|
63
|
+
private readonly _onDidChangeViewVisibility;
|
64
|
+
readonly onDidChangeViewVisibility: Event<IView>;
|
65
|
+
private readonly _onDidFocusView;
|
66
|
+
readonly onDidFocusView: Event<IView>;
|
67
|
+
private readonly _onDidBlurView;
|
68
|
+
readonly onDidBlurView: Event<IView>;
|
69
|
+
get onDidSashChange(): Event<number>;
|
70
|
+
get panes(): ViewPane[];
|
71
|
+
get views(): IView[];
|
72
|
+
get length(): number;
|
73
|
+
private _menuActions?;
|
74
|
+
get menuActions(): CompositeMenuActions | undefined;
|
75
|
+
constructor(id: string, options: IViewPaneContainerOptions, instantiationService: IInstantiationService, configurationService: IConfigurationService, layoutService: IWorkbenchLayoutService, contextMenuService: IContextMenuService, telemetryService: ITelemetryService, extensionService: IExtensionService, themeService: IThemeService, storageService: IStorageService, contextService: IWorkspaceContextService, viewDescriptorService: IViewDescriptorService, logService: ILogService);
|
76
|
+
create(parent: HTMLElement): void;
|
77
|
+
getTitle(): string;
|
78
|
+
private showContextMenu;
|
79
|
+
getActionsContext(): unknown;
|
80
|
+
getActionViewItem(action: IAction, options: IBaseActionViewItemOptions): IActionViewItem | undefined;
|
81
|
+
focus(): void;
|
82
|
+
private get orientation();
|
83
|
+
layout(dimension: Dimension): void;
|
84
|
+
setBoundarySashes(sashes: IBoundarySashes): void;
|
85
|
+
getOptimalWidth(): number;
|
86
|
+
addPanes(panes: {
|
87
|
+
pane: ViewPane;
|
88
|
+
size: number;
|
89
|
+
index?: number;
|
90
|
+
disposable: IDisposable;
|
91
|
+
}[]): void;
|
92
|
+
setVisible(visible: boolean): void;
|
93
|
+
isVisible(): boolean;
|
94
|
+
protected updateTitleArea(): void;
|
95
|
+
protected createView(viewDescriptor: IViewDescriptor, options: IViewletViewOptions): ViewPane;
|
96
|
+
getView(id: string): ViewPane | undefined;
|
97
|
+
private saveViewSizes;
|
98
|
+
private restoreViewSizes;
|
99
|
+
private computeInitialSizes;
|
100
|
+
protected saveState(): void;
|
101
|
+
private onContextMenu;
|
102
|
+
openView(id: string, focus?: boolean): IView | undefined;
|
103
|
+
protected onDidAddViewDescriptors(added: IAddedViewDescriptorRef[]): ViewPane[];
|
104
|
+
private onDidRemoveViewDescriptors;
|
105
|
+
toggleViewVisibility(viewId: string): void;
|
106
|
+
private addPane;
|
107
|
+
removePanes(panes: ViewPane[]): void;
|
108
|
+
private removePane;
|
109
|
+
movePane(from: ViewPane, to: ViewPane): void;
|
110
|
+
resizePane(pane: ViewPane, size: number): void;
|
111
|
+
getPaneSize(pane: ViewPane): number;
|
112
|
+
private updateViewHeaders;
|
113
|
+
isViewMergedWithContainer(): boolean;
|
114
|
+
private onDidScrollPane;
|
115
|
+
private onDidSashReset;
|
116
|
+
dispose(): void;
|
117
|
+
}
|
118
|
+
export declare abstract class ViewPaneContainerAction<T extends IViewPaneContainer> extends Action2 {
|
119
|
+
readonly desc: Readonly<IAction2Options> & {
|
120
|
+
viewPaneContainerId: string;
|
121
|
+
};
|
122
|
+
constructor(desc: Readonly<IAction2Options> & {
|
123
|
+
viewPaneContainerId: string;
|
124
|
+
});
|
125
|
+
run(accessor: ServicesAccessor, ...args: any[]): unknown;
|
126
|
+
abstract runInViewPaneContainer(accessor: ServicesAccessor, viewPaneContainer: T, ...args: any[]): unknown;
|
127
|
+
}
|
@@ -0,0 +1,1086 @@
|
|
1
|
+
|
2
|
+
import { registerCss } from '@codingame/monaco-vscode-api/css';
|
3
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
4
|
+
import { $, DragAndDropObserver, addDisposableListener, EventType, getWindow, isAncestor } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
|
5
|
+
import { StandardMouseEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/mouseEvent';
|
6
|
+
import { Gesture, EventType as EventType$1 } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/touch';
|
7
|
+
import { Orientation } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/sash/sash';
|
8
|
+
import { PaneView } from '@codingame/monaco-vscode-501b06ab-3f58-516b-8a1a-c29d375d3da4-common/vscode/vs/base/browser/ui/splitview/paneview';
|
9
|
+
import { RunOnceScheduler } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
10
|
+
import { Event, Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
11
|
+
import { KeyChord, KeyMod, KeyCode } from '@codingame/monaco-vscode-api/vscode/vs/base/common/keyCodes';
|
12
|
+
import { toDisposable, combinedDisposable, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
13
|
+
import { assertIsDefined } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
|
14
|
+
import * as paneviewlet from '@codingame/monaco-vscode-501b06ab-3f58-516b-8a1a-c29d375d3da4-common/vscode/vs/workbench/browser/parts/views/media/paneviewlet.css';
|
15
|
+
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
16
|
+
import { createActionViewItem } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/browser/menuEntryActionViewItem';
|
17
|
+
import { MenuId, MenuRegistry, Action2, registerAction2 } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
|
18
|
+
import { IMenuService } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions.service';
|
19
|
+
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
20
|
+
import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
|
21
|
+
import { IContextMenuService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextview/browser/contextView.service';
|
22
|
+
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
23
|
+
import { KeybindingWeight } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybindingsRegistry';
|
24
|
+
import { StorageScope, StorageTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
|
25
|
+
import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
|
26
|
+
import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
|
27
|
+
import { asCssVariable } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colorUtils';
|
28
|
+
import { activeContrastBorder } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/baseColors';
|
29
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/chartsColors';
|
30
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/editorColors';
|
31
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/inputColors';
|
32
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/listColors';
|
33
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/menuColors';
|
34
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/minimapColors';
|
35
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/miscColors';
|
36
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/quickpickColors';
|
37
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/searchColors';
|
38
|
+
import { Themable } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService';
|
39
|
+
import { IThemeService } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service';
|
40
|
+
import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
|
41
|
+
import { CompositeMenuActions } from '@codingame/monaco-vscode-501b06ab-3f58-516b-8a1a-c29d375d3da4-common/vscode/vs/workbench/browser/actions';
|
42
|
+
import { CompositeDragAndDropObserver, toggleDropEffect } from '@codingame/monaco-vscode-924e8f00-6faf-5059-b518-e43427d29ab3-common/vscode/vs/workbench/browser/dnd';
|
43
|
+
import { Component } from '@codingame/monaco-vscode-924e8f00-6faf-5059-b518-e43427d29ab3-common/vscode/vs/workbench/common/component';
|
44
|
+
import { PANEL_SECTION_DRAG_AND_DROP_BACKGROUND, SIDE_BAR_DRAG_AND_DROP_BACKGROUND, PANEL_SECTION_BORDER, PANEL_SECTION_HEADER_BORDER, SIDE_BAR_SECTION_HEADER_BORDER, PANEL_SECTION_HEADER_BACKGROUND, SIDE_BAR_SECTION_HEADER_BACKGROUND, PANEL_SECTION_HEADER_FOREGROUND, SIDE_BAR_SECTION_HEADER_FOREGROUND } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/theme';
|
45
|
+
import { ViewContainerLocation, ViewContainerLocationToString, ViewVisibilityState } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/views';
|
46
|
+
import { IViewDescriptorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/views.service';
|
47
|
+
import { IViewsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/views/common/viewsService.service';
|
48
|
+
import { FocusedViewContext } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/contextkeys';
|
49
|
+
import { IExtensionService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions.service';
|
50
|
+
import { LayoutSettings, isHorizontal } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/layout/browser/layoutService';
|
51
|
+
import { IWorkbenchLayoutService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/layout/browser/layoutService.service';
|
52
|
+
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
53
|
+
|
54
|
+
registerCss(paneviewlet);
|
55
|
+
const ViewsSubMenu = ( new MenuId('Views'));
|
56
|
+
MenuRegistry.appendMenuItem(MenuId.ViewContainerTitle, {
|
57
|
+
submenu: ViewsSubMenu,
|
58
|
+
title: ( localize(3544, "Views")),
|
59
|
+
order: 1,
|
60
|
+
});
|
61
|
+
var DropDirection;
|
62
|
+
(function (DropDirection) {
|
63
|
+
DropDirection[DropDirection["UP"] = 0] = "UP";
|
64
|
+
DropDirection[DropDirection["DOWN"] = 1] = "DOWN";
|
65
|
+
DropDirection[DropDirection["LEFT"] = 2] = "LEFT";
|
66
|
+
DropDirection[DropDirection["RIGHT"] = 3] = "RIGHT";
|
67
|
+
})(DropDirection || (DropDirection = {}));
|
68
|
+
class ViewPaneDropOverlay extends Themable {
|
69
|
+
static { this.OVERLAY_ID = 'monaco-pane-drop-overlay'; }
|
70
|
+
get currentDropOperation() {
|
71
|
+
return this._currentDropOperation;
|
72
|
+
}
|
73
|
+
constructor(paneElement, orientation, bounds, location, themeService) {
|
74
|
+
super(themeService);
|
75
|
+
this.paneElement = paneElement;
|
76
|
+
this.orientation = orientation;
|
77
|
+
this.bounds = bounds;
|
78
|
+
this.location = location;
|
79
|
+
this.cleanupOverlayScheduler = this._register(( new RunOnceScheduler(() => this.dispose(), 300)));
|
80
|
+
this.create();
|
81
|
+
}
|
82
|
+
get disposed() {
|
83
|
+
return !!this._disposed;
|
84
|
+
}
|
85
|
+
create() {
|
86
|
+
this.container = $('div', { id: ViewPaneDropOverlay.OVERLAY_ID });
|
87
|
+
this.container.style.top = '0px';
|
88
|
+
this.paneElement.appendChild(this.container);
|
89
|
+
this.paneElement.classList.add('dragged-over');
|
90
|
+
this._register(toDisposable(() => {
|
91
|
+
this.container.remove();
|
92
|
+
this.paneElement.classList.remove('dragged-over');
|
93
|
+
}));
|
94
|
+
this.overlay = $('.pane-overlay-indicator');
|
95
|
+
this.container.appendChild(this.overlay);
|
96
|
+
this.registerListeners();
|
97
|
+
this.updateStyles();
|
98
|
+
}
|
99
|
+
updateStyles() {
|
100
|
+
this.overlay.style.backgroundColor = this.getColor(this.location === ViewContainerLocation.Panel ? PANEL_SECTION_DRAG_AND_DROP_BACKGROUND : SIDE_BAR_DRAG_AND_DROP_BACKGROUND) || '';
|
101
|
+
const activeContrastBorderColor = this.getColor(activeContrastBorder);
|
102
|
+
this.overlay.style.outlineColor = activeContrastBorderColor || '';
|
103
|
+
this.overlay.style.outlineOffset = activeContrastBorderColor ? '-2px' : '';
|
104
|
+
this.overlay.style.outlineStyle = activeContrastBorderColor ? 'dashed' : '';
|
105
|
+
this.overlay.style.outlineWidth = activeContrastBorderColor ? '2px' : '';
|
106
|
+
this.overlay.style.borderColor = activeContrastBorderColor || '';
|
107
|
+
this.overlay.style.borderStyle = 'solid';
|
108
|
+
this.overlay.style.borderWidth = '0px';
|
109
|
+
}
|
110
|
+
registerListeners() {
|
111
|
+
this._register(( new DragAndDropObserver(this.container, {
|
112
|
+
onDragOver: e => {
|
113
|
+
this.positionOverlay(e.offsetX, e.offsetY);
|
114
|
+
if (this.cleanupOverlayScheduler.isScheduled()) {
|
115
|
+
this.cleanupOverlayScheduler.cancel();
|
116
|
+
}
|
117
|
+
},
|
118
|
+
onDragLeave: e => this.dispose(),
|
119
|
+
onDragEnd: e => this.dispose(),
|
120
|
+
onDrop: e => {
|
121
|
+
this.dispose();
|
122
|
+
}
|
123
|
+
})));
|
124
|
+
this._register(addDisposableListener(this.container, EventType.MOUSE_OVER, () => {
|
125
|
+
if (!this.cleanupOverlayScheduler.isScheduled()) {
|
126
|
+
this.cleanupOverlayScheduler.schedule();
|
127
|
+
}
|
128
|
+
}));
|
129
|
+
}
|
130
|
+
positionOverlay(mousePosX, mousePosY) {
|
131
|
+
const paneWidth = this.paneElement.clientWidth;
|
132
|
+
const paneHeight = this.paneElement.clientHeight;
|
133
|
+
const splitWidthThreshold = paneWidth / 2;
|
134
|
+
const splitHeightThreshold = paneHeight / 2;
|
135
|
+
let dropDirection;
|
136
|
+
if (this.orientation === Orientation.VERTICAL) {
|
137
|
+
if (mousePosY < splitHeightThreshold) {
|
138
|
+
dropDirection = DropDirection.UP;
|
139
|
+
}
|
140
|
+
else if (mousePosY >= splitHeightThreshold) {
|
141
|
+
dropDirection = DropDirection.DOWN;
|
142
|
+
}
|
143
|
+
}
|
144
|
+
else if (this.orientation === Orientation.HORIZONTAL) {
|
145
|
+
if (mousePosX < splitWidthThreshold) {
|
146
|
+
dropDirection = DropDirection.LEFT;
|
147
|
+
}
|
148
|
+
else if (mousePosX >= splitWidthThreshold) {
|
149
|
+
dropDirection = DropDirection.RIGHT;
|
150
|
+
}
|
151
|
+
}
|
152
|
+
switch (dropDirection) {
|
153
|
+
case DropDirection.UP:
|
154
|
+
this.doPositionOverlay({ top: '0', left: '0', width: '100%', height: '50%' });
|
155
|
+
break;
|
156
|
+
case DropDirection.DOWN:
|
157
|
+
this.doPositionOverlay({ bottom: '0', left: '0', width: '100%', height: '50%' });
|
158
|
+
break;
|
159
|
+
case DropDirection.LEFT:
|
160
|
+
this.doPositionOverlay({ top: '0', left: '0', width: '50%', height: '100%' });
|
161
|
+
break;
|
162
|
+
case DropDirection.RIGHT:
|
163
|
+
this.doPositionOverlay({ top: '0', right: '0', width: '50%', height: '100%' });
|
164
|
+
break;
|
165
|
+
default: {
|
166
|
+
let top = '0';
|
167
|
+
let left = '0';
|
168
|
+
let width = '100%';
|
169
|
+
let height = '100%';
|
170
|
+
if (this.bounds) {
|
171
|
+
const boundingRect = this.container.getBoundingClientRect();
|
172
|
+
top = `${this.bounds.top - boundingRect.top}px`;
|
173
|
+
left = `${this.bounds.left - boundingRect.left}px`;
|
174
|
+
height = `${this.bounds.bottom - this.bounds.top}px`;
|
175
|
+
width = `${this.bounds.right - this.bounds.left}px`;
|
176
|
+
}
|
177
|
+
this.doPositionOverlay({ top, left, width, height });
|
178
|
+
}
|
179
|
+
}
|
180
|
+
if ((this.orientation === Orientation.VERTICAL && paneHeight <= 25) ||
|
181
|
+
(this.orientation === Orientation.HORIZONTAL && paneWidth <= 25)) {
|
182
|
+
this.doUpdateOverlayBorder(dropDirection);
|
183
|
+
}
|
184
|
+
else {
|
185
|
+
this.doUpdateOverlayBorder(undefined);
|
186
|
+
}
|
187
|
+
this.overlay.style.opacity = '1';
|
188
|
+
setTimeout(() => this.overlay.classList.add('overlay-move-transition'), 0);
|
189
|
+
this._currentDropOperation = dropDirection;
|
190
|
+
}
|
191
|
+
doUpdateOverlayBorder(direction) {
|
192
|
+
this.overlay.style.borderTopWidth = direction === DropDirection.UP ? '2px' : '0px';
|
193
|
+
this.overlay.style.borderLeftWidth = direction === DropDirection.LEFT ? '2px' : '0px';
|
194
|
+
this.overlay.style.borderBottomWidth = direction === DropDirection.DOWN ? '2px' : '0px';
|
195
|
+
this.overlay.style.borderRightWidth = direction === DropDirection.RIGHT ? '2px' : '0px';
|
196
|
+
}
|
197
|
+
doPositionOverlay(options) {
|
198
|
+
this.container.style.height = '100%';
|
199
|
+
this.overlay.style.top = options.top || '';
|
200
|
+
this.overlay.style.left = options.left || '';
|
201
|
+
this.overlay.style.bottom = options.bottom || '';
|
202
|
+
this.overlay.style.right = options.right || '';
|
203
|
+
this.overlay.style.width = options.width;
|
204
|
+
this.overlay.style.height = options.height;
|
205
|
+
}
|
206
|
+
contains(element) {
|
207
|
+
return element === this.container || element === this.overlay;
|
208
|
+
}
|
209
|
+
dispose() {
|
210
|
+
super.dispose();
|
211
|
+
this._disposed = true;
|
212
|
+
}
|
213
|
+
}
|
214
|
+
let ViewContainerMenuActions = class ViewContainerMenuActions extends CompositeMenuActions {
|
215
|
+
constructor(element, viewContainer, viewDescriptorService, contextKeyService, menuService) {
|
216
|
+
const scopedContextKeyService = contextKeyService.createScoped(element);
|
217
|
+
scopedContextKeyService.createKey('viewContainer', viewContainer.id);
|
218
|
+
const viewContainerLocationKey = scopedContextKeyService.createKey('viewContainerLocation', ViewContainerLocationToString(viewDescriptorService.getViewContainerLocation(viewContainer)));
|
219
|
+
super(MenuId.ViewContainerTitle, MenuId.ViewContainerTitleContext, { shouldForwardArgs: true, renderShortTitle: true }, scopedContextKeyService, menuService);
|
220
|
+
this._register(scopedContextKeyService);
|
221
|
+
this._register(Event.filter(viewDescriptorService.onDidChangeContainerLocation, e => e.viewContainer === viewContainer)(() => viewContainerLocationKey.set(ViewContainerLocationToString(viewDescriptorService.getViewContainerLocation(viewContainer)))));
|
222
|
+
}
|
223
|
+
};
|
224
|
+
ViewContainerMenuActions = ( __decorate([
|
225
|
+
( __param(2, IViewDescriptorService)),
|
226
|
+
( __param(3, IContextKeyService)),
|
227
|
+
( __param(4, IMenuService))
|
228
|
+
], ViewContainerMenuActions));
|
229
|
+
let ViewPaneContainer = class ViewPaneContainer extends Component {
|
230
|
+
get onDidSashChange() {
|
231
|
+
return assertIsDefined(this.paneview).onDidSashChange;
|
232
|
+
}
|
233
|
+
get panes() {
|
234
|
+
return ( this.paneItems.map(i => i.pane));
|
235
|
+
}
|
236
|
+
get views() {
|
237
|
+
return this.panes;
|
238
|
+
}
|
239
|
+
get length() {
|
240
|
+
return this.paneItems.length;
|
241
|
+
}
|
242
|
+
get menuActions() {
|
243
|
+
return this._menuActions;
|
244
|
+
}
|
245
|
+
constructor(id, options, instantiationService, configurationService, layoutService, contextMenuService, telemetryService, extensionService, themeService, storageService, contextService, viewDescriptorService, logService) {
|
246
|
+
super(id, themeService, storageService);
|
247
|
+
this.options = options;
|
248
|
+
this.instantiationService = instantiationService;
|
249
|
+
this.configurationService = configurationService;
|
250
|
+
this.layoutService = layoutService;
|
251
|
+
this.contextMenuService = contextMenuService;
|
252
|
+
this.telemetryService = telemetryService;
|
253
|
+
this.extensionService = extensionService;
|
254
|
+
this.storageService = storageService;
|
255
|
+
this.contextService = contextService;
|
256
|
+
this.viewDescriptorService = viewDescriptorService;
|
257
|
+
this.logService = logService;
|
258
|
+
this.paneItems = [];
|
259
|
+
this.visible = false;
|
260
|
+
this.areExtensionsReady = false;
|
261
|
+
this.didLayout = false;
|
262
|
+
this._onTitleAreaUpdate = this._register(( new Emitter()));
|
263
|
+
this.onTitleAreaUpdate = this._onTitleAreaUpdate.event;
|
264
|
+
this._onDidChangeVisibility = this._register(( new Emitter()));
|
265
|
+
this.onDidChangeVisibility = this._onDidChangeVisibility.event;
|
266
|
+
this._onDidAddViews = this._register(( new Emitter()));
|
267
|
+
this.onDidAddViews = this._onDidAddViews.event;
|
268
|
+
this._onDidRemoveViews = this._register(( new Emitter()));
|
269
|
+
this.onDidRemoveViews = this._onDidRemoveViews.event;
|
270
|
+
this._onDidChangeViewVisibility = this._register(( new Emitter()));
|
271
|
+
this.onDidChangeViewVisibility = this._onDidChangeViewVisibility.event;
|
272
|
+
this._onDidFocusView = this._register(( new Emitter()));
|
273
|
+
this.onDidFocusView = this._onDidFocusView.event;
|
274
|
+
this._onDidBlurView = this._register(( new Emitter()));
|
275
|
+
this.onDidBlurView = this._onDidBlurView.event;
|
276
|
+
const container = this.viewDescriptorService.getViewContainerById(id);
|
277
|
+
if (!container) {
|
278
|
+
throw ( new Error('Could not find container'));
|
279
|
+
}
|
280
|
+
this.viewContainer = container;
|
281
|
+
this.visibleViewsStorageId = `${id}.numberOfVisibleViews`;
|
282
|
+
this.visibleViewsCountFromCache = this.storageService.getNumber(this.visibleViewsStorageId, StorageScope.WORKSPACE, undefined);
|
283
|
+
this.viewContainerModel = this.viewDescriptorService.getViewContainerModel(container);
|
284
|
+
}
|
285
|
+
create(parent) {
|
286
|
+
const options = this.options;
|
287
|
+
options.orientation = this.orientation;
|
288
|
+
this.paneview = this._register(( new PaneView(parent, this.options)));
|
289
|
+
if (this._boundarySashes) {
|
290
|
+
this.paneview.setBoundarySashes(this._boundarySashes);
|
291
|
+
}
|
292
|
+
this._register(this.paneview.onDidDrop(({ from, to }) => this.movePane(from, to)));
|
293
|
+
this._register(this.paneview.onDidScroll(_ => this.onDidScrollPane()));
|
294
|
+
this._register(this.paneview.onDidSashReset((index) => this.onDidSashReset(index)));
|
295
|
+
this._register(addDisposableListener(parent, EventType.CONTEXT_MENU, (e) => this.showContextMenu(( new StandardMouseEvent(getWindow(parent), e)))));
|
296
|
+
this._register(Gesture.addTarget(parent));
|
297
|
+
this._register(addDisposableListener(parent, EventType$1.Contextmenu, (e) => this.showContextMenu(( new StandardMouseEvent(getWindow(parent), e)))));
|
298
|
+
this._menuActions = this._register(this.instantiationService.createInstance(ViewContainerMenuActions, this.paneview.element, this.viewContainer));
|
299
|
+
this._register(this._menuActions.onDidChange(() => this.updateTitleArea()));
|
300
|
+
let overlay;
|
301
|
+
const getOverlayBounds = () => {
|
302
|
+
const fullSize = parent.getBoundingClientRect();
|
303
|
+
const lastPane = this.panes[this.panes.length - 1].element.getBoundingClientRect();
|
304
|
+
const top = this.orientation === Orientation.VERTICAL ? lastPane.bottom : fullSize.top;
|
305
|
+
const left = this.orientation === Orientation.HORIZONTAL ? lastPane.right : fullSize.left;
|
306
|
+
return {
|
307
|
+
top,
|
308
|
+
bottom: fullSize.bottom,
|
309
|
+
left,
|
310
|
+
right: fullSize.right,
|
311
|
+
};
|
312
|
+
};
|
313
|
+
const inBounds = (bounds, pos) => {
|
314
|
+
return pos.x >= bounds.left && pos.x <= bounds.right && pos.y >= bounds.top && pos.y <= bounds.bottom;
|
315
|
+
};
|
316
|
+
let bounds;
|
317
|
+
this._register(CompositeDragAndDropObserver.INSTANCE.registerTarget(parent, {
|
318
|
+
onDragEnter: (e) => {
|
319
|
+
bounds = getOverlayBounds();
|
320
|
+
if (overlay && overlay.disposed) {
|
321
|
+
overlay = undefined;
|
322
|
+
}
|
323
|
+
if (!overlay && inBounds(bounds, e.eventData)) {
|
324
|
+
const dropData = e.dragAndDropData.getData();
|
325
|
+
if (dropData.type === 'view') {
|
326
|
+
const oldViewContainer = this.viewDescriptorService.getViewContainerByViewId(dropData.id);
|
327
|
+
const viewDescriptor = this.viewDescriptorService.getViewDescriptorById(dropData.id);
|
328
|
+
if (oldViewContainer !== this.viewContainer && (!viewDescriptor || !viewDescriptor.canMoveView || this.viewContainer.rejectAddedViews)) {
|
329
|
+
return;
|
330
|
+
}
|
331
|
+
overlay = ( new ViewPaneDropOverlay(
|
332
|
+
parent,
|
333
|
+
undefined,
|
334
|
+
bounds,
|
335
|
+
this.viewDescriptorService.getViewContainerLocation(this.viewContainer),
|
336
|
+
this.themeService
|
337
|
+
));
|
338
|
+
}
|
339
|
+
if (dropData.type === 'composite' && dropData.id !== this.viewContainer.id) {
|
340
|
+
const container = this.viewDescriptorService.getViewContainerById(dropData.id);
|
341
|
+
const viewsToMove = this.viewDescriptorService.getViewContainerModel(container).allViewDescriptors;
|
342
|
+
if (!( viewsToMove.some(v => !v.canMoveView)) && viewsToMove.length > 0) {
|
343
|
+
overlay = ( new ViewPaneDropOverlay(
|
344
|
+
parent,
|
345
|
+
undefined,
|
346
|
+
bounds,
|
347
|
+
this.viewDescriptorService.getViewContainerLocation(this.viewContainer),
|
348
|
+
this.themeService
|
349
|
+
));
|
350
|
+
}
|
351
|
+
}
|
352
|
+
}
|
353
|
+
},
|
354
|
+
onDragOver: (e) => {
|
355
|
+
if (overlay && overlay.disposed) {
|
356
|
+
overlay = undefined;
|
357
|
+
}
|
358
|
+
if (overlay && !inBounds(bounds, e.eventData)) {
|
359
|
+
overlay.dispose();
|
360
|
+
overlay = undefined;
|
361
|
+
}
|
362
|
+
if (inBounds(bounds, e.eventData)) {
|
363
|
+
toggleDropEffect(e.eventData.dataTransfer, 'move', overlay !== undefined);
|
364
|
+
}
|
365
|
+
},
|
366
|
+
onDragLeave: (e) => {
|
367
|
+
overlay?.dispose();
|
368
|
+
overlay = undefined;
|
369
|
+
},
|
370
|
+
onDrop: (e) => {
|
371
|
+
if (overlay) {
|
372
|
+
const dropData = e.dragAndDropData.getData();
|
373
|
+
const viewsToMove = [];
|
374
|
+
if (dropData.type === 'composite' && dropData.id !== this.viewContainer.id) {
|
375
|
+
const container = this.viewDescriptorService.getViewContainerById(dropData.id);
|
376
|
+
const allViews = this.viewDescriptorService.getViewContainerModel(container).allViewDescriptors;
|
377
|
+
if (!( allViews.some(v => !v.canMoveView))) {
|
378
|
+
viewsToMove.push(...allViews);
|
379
|
+
}
|
380
|
+
}
|
381
|
+
else if (dropData.type === 'view') {
|
382
|
+
const oldViewContainer = this.viewDescriptorService.getViewContainerByViewId(dropData.id);
|
383
|
+
const viewDescriptor = this.viewDescriptorService.getViewDescriptorById(dropData.id);
|
384
|
+
if (oldViewContainer !== this.viewContainer && viewDescriptor && viewDescriptor.canMoveView) {
|
385
|
+
this.viewDescriptorService.moveViewsToContainer([viewDescriptor], this.viewContainer, undefined, 'dnd');
|
386
|
+
}
|
387
|
+
}
|
388
|
+
const paneCount = this.panes.length;
|
389
|
+
if (viewsToMove.length > 0) {
|
390
|
+
this.viewDescriptorService.moveViewsToContainer(viewsToMove, this.viewContainer, undefined, 'dnd');
|
391
|
+
}
|
392
|
+
if (paneCount > 0) {
|
393
|
+
for (const view of viewsToMove) {
|
394
|
+
const paneToMove = this.panes.find(p => p.id === view.id);
|
395
|
+
if (paneToMove) {
|
396
|
+
this.movePane(paneToMove, this.panes[this.panes.length - 1]);
|
397
|
+
}
|
398
|
+
}
|
399
|
+
}
|
400
|
+
}
|
401
|
+
overlay?.dispose();
|
402
|
+
overlay = undefined;
|
403
|
+
}
|
404
|
+
}));
|
405
|
+
this._register(this.onDidSashChange(() => this.saveViewSizes()));
|
406
|
+
this._register(this.viewContainerModel.onDidAddVisibleViewDescriptors(added => this.onDidAddViewDescriptors(added)));
|
407
|
+
this._register(this.viewContainerModel.onDidRemoveVisibleViewDescriptors(removed => this.onDidRemoveViewDescriptors(removed)));
|
408
|
+
const addedViews = ( this.viewContainerModel.visibleViewDescriptors.map((viewDescriptor, index) => {
|
409
|
+
const size = this.viewContainerModel.getSize(viewDescriptor.id);
|
410
|
+
const collapsed = this.viewContainerModel.isCollapsed(viewDescriptor.id);
|
411
|
+
return ({ viewDescriptor, index, size, collapsed });
|
412
|
+
}));
|
413
|
+
if (addedViews.length) {
|
414
|
+
this.onDidAddViewDescriptors(addedViews);
|
415
|
+
}
|
416
|
+
this.extensionService.whenInstalledExtensionsRegistered().then(() => {
|
417
|
+
this.areExtensionsReady = true;
|
418
|
+
if (this.panes.length) {
|
419
|
+
this.updateTitleArea();
|
420
|
+
this.updateViewHeaders();
|
421
|
+
}
|
422
|
+
this._register(this.configurationService.onDidChangeConfiguration(e => {
|
423
|
+
if (e.affectsConfiguration(LayoutSettings.ACTIVITY_BAR_LOCATION)) {
|
424
|
+
this.updateViewHeaders();
|
425
|
+
}
|
426
|
+
}));
|
427
|
+
});
|
428
|
+
this._register(this.viewContainerModel.onDidChangeActiveViewDescriptors(() => this._onTitleAreaUpdate.fire()));
|
429
|
+
}
|
430
|
+
getTitle() {
|
431
|
+
const containerTitle = this.viewContainerModel.title;
|
432
|
+
if (this.isViewMergedWithContainer()) {
|
433
|
+
const singleViewPaneContainerTitle = this.paneItems[0].pane.singleViewPaneContainerTitle;
|
434
|
+
if (singleViewPaneContainerTitle) {
|
435
|
+
return singleViewPaneContainerTitle;
|
436
|
+
}
|
437
|
+
const paneItemTitle = this.paneItems[0].pane.title;
|
438
|
+
if (containerTitle === paneItemTitle) {
|
439
|
+
return paneItemTitle;
|
440
|
+
}
|
441
|
+
return paneItemTitle ? `${containerTitle}: ${paneItemTitle}` : containerTitle;
|
442
|
+
}
|
443
|
+
return containerTitle;
|
444
|
+
}
|
445
|
+
showContextMenu(event) {
|
446
|
+
for (const paneItem of this.paneItems) {
|
447
|
+
if (isAncestor(event.target, paneItem.pane.element)) {
|
448
|
+
return;
|
449
|
+
}
|
450
|
+
}
|
451
|
+
event.stopPropagation();
|
452
|
+
event.preventDefault();
|
453
|
+
this.contextMenuService.showContextMenu({
|
454
|
+
getAnchor: () => event,
|
455
|
+
getActions: () => this.menuActions?.getContextMenuActions() ?? []
|
456
|
+
});
|
457
|
+
}
|
458
|
+
getActionsContext() {
|
459
|
+
if (this.isViewMergedWithContainer()) {
|
460
|
+
return this.panes[0].getActionsContext();
|
461
|
+
}
|
462
|
+
return undefined;
|
463
|
+
}
|
464
|
+
getActionViewItem(action, options) {
|
465
|
+
if (this.isViewMergedWithContainer()) {
|
466
|
+
return this.paneItems[0].pane.createActionViewItem(action, options);
|
467
|
+
}
|
468
|
+
return createActionViewItem(this.instantiationService, action, options);
|
469
|
+
}
|
470
|
+
focus() {
|
471
|
+
let paneToFocus = undefined;
|
472
|
+
if (this.lastFocusedPane) {
|
473
|
+
paneToFocus = this.lastFocusedPane;
|
474
|
+
}
|
475
|
+
else if (this.paneItems.length > 0) {
|
476
|
+
for (const { pane } of this.paneItems) {
|
477
|
+
if (pane.isExpanded()) {
|
478
|
+
paneToFocus = pane;
|
479
|
+
break;
|
480
|
+
}
|
481
|
+
}
|
482
|
+
}
|
483
|
+
if (paneToFocus) {
|
484
|
+
paneToFocus.focus();
|
485
|
+
}
|
486
|
+
}
|
487
|
+
get orientation() {
|
488
|
+
switch (this.viewDescriptorService.getViewContainerLocation(this.viewContainer)) {
|
489
|
+
case ViewContainerLocation.Sidebar:
|
490
|
+
case ViewContainerLocation.AuxiliaryBar:
|
491
|
+
return Orientation.VERTICAL;
|
492
|
+
case ViewContainerLocation.Panel: {
|
493
|
+
return isHorizontal(this.layoutService.getPanelPosition()) ? Orientation.HORIZONTAL : Orientation.VERTICAL;
|
494
|
+
}
|
495
|
+
}
|
496
|
+
return Orientation.VERTICAL;
|
497
|
+
}
|
498
|
+
layout(dimension) {
|
499
|
+
if (this.paneview) {
|
500
|
+
if (this.paneview.orientation !== this.orientation) {
|
501
|
+
this.paneview.flipOrientation(dimension.height, dimension.width);
|
502
|
+
}
|
503
|
+
this.paneview.layout(dimension.height, dimension.width);
|
504
|
+
}
|
505
|
+
this.dimension = dimension;
|
506
|
+
if (this.didLayout) {
|
507
|
+
this.saveViewSizes();
|
508
|
+
}
|
509
|
+
else {
|
510
|
+
this.didLayout = true;
|
511
|
+
this.restoreViewSizes();
|
512
|
+
}
|
513
|
+
}
|
514
|
+
setBoundarySashes(sashes) {
|
515
|
+
this._boundarySashes = sashes;
|
516
|
+
this.paneview?.setBoundarySashes(sashes);
|
517
|
+
}
|
518
|
+
getOptimalWidth() {
|
519
|
+
const additionalMargin = 16;
|
520
|
+
const optimalWidth = Math.max(...( this.panes.map(view => view.getOptimalWidth() || 0)));
|
521
|
+
return optimalWidth + additionalMargin;
|
522
|
+
}
|
523
|
+
addPanes(panes) {
|
524
|
+
const wasMerged = this.isViewMergedWithContainer();
|
525
|
+
for (const { pane, size, index, disposable } of panes) {
|
526
|
+
this.addPane(pane, size, disposable, index);
|
527
|
+
}
|
528
|
+
this.updateViewHeaders();
|
529
|
+
if (this.isViewMergedWithContainer() !== wasMerged) {
|
530
|
+
this.updateTitleArea();
|
531
|
+
}
|
532
|
+
this._onDidAddViews.fire(( panes.map(({ pane }) => pane)));
|
533
|
+
}
|
534
|
+
setVisible(visible) {
|
535
|
+
if (this.visible !== !!visible) {
|
536
|
+
this.visible = visible;
|
537
|
+
this._onDidChangeVisibility.fire(visible);
|
538
|
+
}
|
539
|
+
this.panes.filter(view => view.isVisible() !== visible)
|
540
|
+
.forEach((view) => view.setVisible(visible));
|
541
|
+
}
|
542
|
+
isVisible() {
|
543
|
+
return this.visible;
|
544
|
+
}
|
545
|
+
updateTitleArea() {
|
546
|
+
this._onTitleAreaUpdate.fire();
|
547
|
+
}
|
548
|
+
createView(viewDescriptor, options) {
|
549
|
+
return this.instantiationService.createInstance(viewDescriptor.ctorDescriptor.ctor, ...(viewDescriptor.ctorDescriptor.staticArguments || []), options);
|
550
|
+
}
|
551
|
+
getView(id) {
|
552
|
+
return this.panes.filter(view => view.id === id)[0];
|
553
|
+
}
|
554
|
+
saveViewSizes() {
|
555
|
+
if (this.didLayout) {
|
556
|
+
this.viewContainerModel.setSizes(( this.panes.map(view => ({ id: view.id, size: this.getPaneSize(view) }))));
|
557
|
+
}
|
558
|
+
}
|
559
|
+
restoreViewSizes() {
|
560
|
+
if (this.didLayout) {
|
561
|
+
let initialSizes;
|
562
|
+
for (let i = 0; i < this.viewContainerModel.visibleViewDescriptors.length; i++) {
|
563
|
+
const pane = this.panes[i];
|
564
|
+
const viewDescriptor = this.viewContainerModel.visibleViewDescriptors[i];
|
565
|
+
const size = this.viewContainerModel.getSize(viewDescriptor.id);
|
566
|
+
if (typeof size === 'number') {
|
567
|
+
this.resizePane(pane, size);
|
568
|
+
}
|
569
|
+
else {
|
570
|
+
initialSizes = initialSizes ? initialSizes : this.computeInitialSizes();
|
571
|
+
this.resizePane(pane, initialSizes.get(pane.id) || 200);
|
572
|
+
}
|
573
|
+
}
|
574
|
+
}
|
575
|
+
}
|
576
|
+
computeInitialSizes() {
|
577
|
+
const sizes = ( new Map());
|
578
|
+
if (this.dimension) {
|
579
|
+
const totalWeight = this.viewContainerModel.visibleViewDescriptors.reduce((totalWeight, { weight }) => totalWeight + (weight || 20), 0);
|
580
|
+
for (const viewDescriptor of this.viewContainerModel.visibleViewDescriptors) {
|
581
|
+
if (this.orientation === Orientation.VERTICAL) {
|
582
|
+
sizes.set(viewDescriptor.id, this.dimension.height * (viewDescriptor.weight || 20) / totalWeight);
|
583
|
+
}
|
584
|
+
else {
|
585
|
+
sizes.set(viewDescriptor.id, this.dimension.width * (viewDescriptor.weight || 20) / totalWeight);
|
586
|
+
}
|
587
|
+
}
|
588
|
+
}
|
589
|
+
return sizes;
|
590
|
+
}
|
591
|
+
saveState() {
|
592
|
+
this.panes.forEach((view) => view.saveState());
|
593
|
+
this.storageService.store(this.visibleViewsStorageId, this.length, StorageScope.WORKSPACE, StorageTarget.MACHINE);
|
594
|
+
}
|
595
|
+
onContextMenu(event, viewPane) {
|
596
|
+
event.stopPropagation();
|
597
|
+
event.preventDefault();
|
598
|
+
const actions = viewPane.menuActions.getContextMenuActions();
|
599
|
+
this.contextMenuService.showContextMenu({
|
600
|
+
getAnchor: () => event,
|
601
|
+
getActions: () => actions
|
602
|
+
});
|
603
|
+
}
|
604
|
+
openView(id, focus) {
|
605
|
+
let view = this.getView(id);
|
606
|
+
if (!view) {
|
607
|
+
this.toggleViewVisibility(id);
|
608
|
+
}
|
609
|
+
view = this.getView(id);
|
610
|
+
if (view) {
|
611
|
+
view.setExpanded(true);
|
612
|
+
if (focus) {
|
613
|
+
view.focus();
|
614
|
+
}
|
615
|
+
}
|
616
|
+
return view;
|
617
|
+
}
|
618
|
+
onDidAddViewDescriptors(added) {
|
619
|
+
const panesToAdd = [];
|
620
|
+
for (const { viewDescriptor, collapsed, index, size } of added) {
|
621
|
+
const pane = this.createView(viewDescriptor, {
|
622
|
+
id: viewDescriptor.id,
|
623
|
+
title: viewDescriptor.name.value,
|
624
|
+
fromExtensionId: viewDescriptor.extensionId,
|
625
|
+
expanded: !collapsed,
|
626
|
+
singleViewPaneContainerTitle: viewDescriptor.singleViewPaneContainerTitle,
|
627
|
+
});
|
628
|
+
try {
|
629
|
+
pane.render();
|
630
|
+
}
|
631
|
+
catch (error) {
|
632
|
+
this.logService.error(`Fail to render view ${viewDescriptor.id}`, error);
|
633
|
+
continue;
|
634
|
+
}
|
635
|
+
if (pane.draggableElement) {
|
636
|
+
const contextMenuDisposable = addDisposableListener(pane.draggableElement, 'contextmenu', e => {
|
637
|
+
e.stopPropagation();
|
638
|
+
e.preventDefault();
|
639
|
+
this.onContextMenu(( new StandardMouseEvent(getWindow(pane.draggableElement), e)), pane);
|
640
|
+
});
|
641
|
+
const collapseDisposable = Event.latch(( Event.map(pane.onDidChange, () => !pane.isExpanded())))(collapsed => {
|
642
|
+
this.viewContainerModel.setCollapsed(viewDescriptor.id, collapsed);
|
643
|
+
});
|
644
|
+
panesToAdd.push({ pane, size: size || pane.minimumSize, index, disposable: combinedDisposable(contextMenuDisposable, collapseDisposable) });
|
645
|
+
}
|
646
|
+
}
|
647
|
+
this.addPanes(panesToAdd);
|
648
|
+
this.restoreViewSizes();
|
649
|
+
const panes = [];
|
650
|
+
for (const { pane } of panesToAdd) {
|
651
|
+
pane.setVisible(this.isVisible());
|
652
|
+
panes.push(pane);
|
653
|
+
}
|
654
|
+
return panes;
|
655
|
+
}
|
656
|
+
onDidRemoveViewDescriptors(removed) {
|
657
|
+
removed = removed.sort((a, b) => b.index - a.index);
|
658
|
+
const panesToRemove = [];
|
659
|
+
for (const { index } of removed) {
|
660
|
+
const paneItem = this.paneItems[index];
|
661
|
+
if (paneItem) {
|
662
|
+
panesToRemove.push(this.paneItems[index].pane);
|
663
|
+
}
|
664
|
+
}
|
665
|
+
if (panesToRemove.length) {
|
666
|
+
this.removePanes(panesToRemove);
|
667
|
+
for (const pane of panesToRemove) {
|
668
|
+
pane.setVisible(false);
|
669
|
+
}
|
670
|
+
}
|
671
|
+
}
|
672
|
+
toggleViewVisibility(viewId) {
|
673
|
+
if (( this.viewContainerModel.activeViewDescriptors.some(viewDescriptor => viewDescriptor.id === viewId))) {
|
674
|
+
const visible = !this.viewContainerModel.isVisible(viewId);
|
675
|
+
this.viewContainerModel.setVisible(viewId, visible);
|
676
|
+
}
|
677
|
+
}
|
678
|
+
addPane(pane, size, disposable, index = this.paneItems.length - 1) {
|
679
|
+
const onDidFocus = pane.onDidFocus(() => {
|
680
|
+
this._onDidFocusView.fire(pane);
|
681
|
+
this.lastFocusedPane = pane;
|
682
|
+
});
|
683
|
+
const onDidBlur = pane.onDidBlur(() => this._onDidBlurView.fire(pane));
|
684
|
+
const onDidChangeTitleArea = pane.onDidChangeTitleArea(() => {
|
685
|
+
if (this.isViewMergedWithContainer()) {
|
686
|
+
this.updateTitleArea();
|
687
|
+
}
|
688
|
+
});
|
689
|
+
const onDidChangeVisibility = pane.onDidChangeBodyVisibility(() => this._onDidChangeViewVisibility.fire(pane));
|
690
|
+
const onDidChange = pane.onDidChange(() => {
|
691
|
+
if (pane === this.lastFocusedPane && !pane.isExpanded()) {
|
692
|
+
this.lastFocusedPane = undefined;
|
693
|
+
}
|
694
|
+
});
|
695
|
+
const isPanel = this.viewDescriptorService.getViewContainerLocation(this.viewContainer) === ViewContainerLocation.Panel;
|
696
|
+
pane.style({
|
697
|
+
headerForeground: asCssVariable(isPanel ? PANEL_SECTION_HEADER_FOREGROUND : SIDE_BAR_SECTION_HEADER_FOREGROUND),
|
698
|
+
headerBackground: asCssVariable(isPanel ? PANEL_SECTION_HEADER_BACKGROUND : SIDE_BAR_SECTION_HEADER_BACKGROUND),
|
699
|
+
headerBorder: asCssVariable(isPanel ? PANEL_SECTION_HEADER_BORDER : SIDE_BAR_SECTION_HEADER_BORDER),
|
700
|
+
dropBackground: asCssVariable(isPanel ? PANEL_SECTION_DRAG_AND_DROP_BACKGROUND : SIDE_BAR_DRAG_AND_DROP_BACKGROUND),
|
701
|
+
leftBorder: isPanel ? asCssVariable(PANEL_SECTION_BORDER) : undefined
|
702
|
+
});
|
703
|
+
const store = ( new DisposableStore());
|
704
|
+
store.add(disposable);
|
705
|
+
store.add(combinedDisposable(pane, onDidFocus, onDidBlur, onDidChangeTitleArea, onDidChange, onDidChangeVisibility));
|
706
|
+
const paneItem = { pane, disposable: store };
|
707
|
+
this.paneItems.splice(index, 0, paneItem);
|
708
|
+
assertIsDefined(this.paneview).addPane(pane, size, index);
|
709
|
+
let overlay;
|
710
|
+
if (pane.draggableElement) {
|
711
|
+
store.add(CompositeDragAndDropObserver.INSTANCE.registerDraggable(pane.draggableElement, () => { return { type: 'view', id: pane.id }; }, {}));
|
712
|
+
}
|
713
|
+
store.add(CompositeDragAndDropObserver.INSTANCE.registerTarget(pane.dropTargetElement, {
|
714
|
+
onDragEnter: (e) => {
|
715
|
+
if (!overlay) {
|
716
|
+
const dropData = e.dragAndDropData.getData();
|
717
|
+
if (dropData.type === 'view' && dropData.id !== pane.id) {
|
718
|
+
const oldViewContainer = this.viewDescriptorService.getViewContainerByViewId(dropData.id);
|
719
|
+
const viewDescriptor = this.viewDescriptorService.getViewDescriptorById(dropData.id);
|
720
|
+
if (oldViewContainer !== this.viewContainer && (!viewDescriptor || !viewDescriptor.canMoveView || this.viewContainer.rejectAddedViews)) {
|
721
|
+
return;
|
722
|
+
}
|
723
|
+
overlay = ( new ViewPaneDropOverlay(
|
724
|
+
pane.dropTargetElement,
|
725
|
+
this.orientation ?? Orientation.VERTICAL,
|
726
|
+
undefined,
|
727
|
+
this.viewDescriptorService.getViewContainerLocation(this.viewContainer),
|
728
|
+
this.themeService
|
729
|
+
));
|
730
|
+
}
|
731
|
+
if (dropData.type === 'composite' && dropData.id !== this.viewContainer.id && !this.viewContainer.rejectAddedViews) {
|
732
|
+
const container = this.viewDescriptorService.getViewContainerById(dropData.id);
|
733
|
+
const viewsToMove = this.viewDescriptorService.getViewContainerModel(container).allViewDescriptors;
|
734
|
+
if (!( viewsToMove.some(v => !v.canMoveView)) && viewsToMove.length > 0) {
|
735
|
+
overlay = ( new ViewPaneDropOverlay(
|
736
|
+
pane.dropTargetElement,
|
737
|
+
this.orientation ?? Orientation.VERTICAL,
|
738
|
+
undefined,
|
739
|
+
this.viewDescriptorService.getViewContainerLocation(this.viewContainer),
|
740
|
+
this.themeService
|
741
|
+
));
|
742
|
+
}
|
743
|
+
}
|
744
|
+
}
|
745
|
+
},
|
746
|
+
onDragOver: (e) => {
|
747
|
+
toggleDropEffect(e.eventData.dataTransfer, 'move', overlay !== undefined);
|
748
|
+
},
|
749
|
+
onDragLeave: (e) => {
|
750
|
+
overlay?.dispose();
|
751
|
+
overlay = undefined;
|
752
|
+
},
|
753
|
+
onDrop: (e) => {
|
754
|
+
if (overlay) {
|
755
|
+
const dropData = e.dragAndDropData.getData();
|
756
|
+
const viewsToMove = [];
|
757
|
+
let anchorView;
|
758
|
+
if (dropData.type === 'composite' && dropData.id !== this.viewContainer.id && !this.viewContainer.rejectAddedViews) {
|
759
|
+
const container = this.viewDescriptorService.getViewContainerById(dropData.id);
|
760
|
+
const allViews = this.viewDescriptorService.getViewContainerModel(container).allViewDescriptors;
|
761
|
+
if (allViews.length > 0 && !( allViews.some(v => !v.canMoveView))) {
|
762
|
+
viewsToMove.push(...allViews);
|
763
|
+
anchorView = allViews[0];
|
764
|
+
}
|
765
|
+
}
|
766
|
+
else if (dropData.type === 'view') {
|
767
|
+
const oldViewContainer = this.viewDescriptorService.getViewContainerByViewId(dropData.id);
|
768
|
+
const viewDescriptor = this.viewDescriptorService.getViewDescriptorById(dropData.id);
|
769
|
+
if (oldViewContainer !== this.viewContainer && viewDescriptor && viewDescriptor.canMoveView && !this.viewContainer.rejectAddedViews) {
|
770
|
+
viewsToMove.push(viewDescriptor);
|
771
|
+
}
|
772
|
+
if (viewDescriptor) {
|
773
|
+
anchorView = viewDescriptor;
|
774
|
+
}
|
775
|
+
}
|
776
|
+
if (viewsToMove) {
|
777
|
+
this.viewDescriptorService.moveViewsToContainer(viewsToMove, this.viewContainer, undefined, 'dnd');
|
778
|
+
}
|
779
|
+
if (anchorView) {
|
780
|
+
if (overlay.currentDropOperation === DropDirection.DOWN ||
|
781
|
+
overlay.currentDropOperation === DropDirection.RIGHT) {
|
782
|
+
const fromIndex = this.panes.findIndex(p => p.id === anchorView.id);
|
783
|
+
let toIndex = this.panes.findIndex(p => p.id === pane.id);
|
784
|
+
if (fromIndex >= 0 && toIndex >= 0) {
|
785
|
+
if (fromIndex > toIndex) {
|
786
|
+
toIndex++;
|
787
|
+
}
|
788
|
+
if (toIndex < this.panes.length && toIndex !== fromIndex) {
|
789
|
+
this.movePane(this.panes[fromIndex], this.panes[toIndex]);
|
790
|
+
}
|
791
|
+
}
|
792
|
+
}
|
793
|
+
if (overlay.currentDropOperation === DropDirection.UP ||
|
794
|
+
overlay.currentDropOperation === DropDirection.LEFT) {
|
795
|
+
const fromIndex = this.panes.findIndex(p => p.id === anchorView.id);
|
796
|
+
let toIndex = this.panes.findIndex(p => p.id === pane.id);
|
797
|
+
if (fromIndex >= 0 && toIndex >= 0) {
|
798
|
+
if (fromIndex < toIndex) {
|
799
|
+
toIndex--;
|
800
|
+
}
|
801
|
+
if (toIndex >= 0 && toIndex !== fromIndex) {
|
802
|
+
this.movePane(this.panes[fromIndex], this.panes[toIndex]);
|
803
|
+
}
|
804
|
+
}
|
805
|
+
}
|
806
|
+
if (viewsToMove.length > 1) {
|
807
|
+
viewsToMove.slice(1).forEach(view => {
|
808
|
+
let toIndex = this.panes.findIndex(p => p.id === anchorView.id);
|
809
|
+
const fromIndex = this.panes.findIndex(p => p.id === view.id);
|
810
|
+
if (fromIndex >= 0 && toIndex >= 0) {
|
811
|
+
if (fromIndex > toIndex) {
|
812
|
+
toIndex++;
|
813
|
+
}
|
814
|
+
if (toIndex < this.panes.length && toIndex !== fromIndex) {
|
815
|
+
this.movePane(this.panes[fromIndex], this.panes[toIndex]);
|
816
|
+
anchorView = view;
|
817
|
+
}
|
818
|
+
}
|
819
|
+
});
|
820
|
+
}
|
821
|
+
}
|
822
|
+
}
|
823
|
+
overlay?.dispose();
|
824
|
+
overlay = undefined;
|
825
|
+
}
|
826
|
+
}));
|
827
|
+
}
|
828
|
+
removePanes(panes) {
|
829
|
+
const wasMerged = this.isViewMergedWithContainer();
|
830
|
+
panes.forEach(pane => this.removePane(pane));
|
831
|
+
this.updateViewHeaders();
|
832
|
+
if (wasMerged !== this.isViewMergedWithContainer()) {
|
833
|
+
this.updateTitleArea();
|
834
|
+
}
|
835
|
+
this._onDidRemoveViews.fire(panes);
|
836
|
+
}
|
837
|
+
removePane(pane) {
|
838
|
+
const index = this.paneItems.findIndex(i => i.pane === pane);
|
839
|
+
if (index === -1) {
|
840
|
+
return;
|
841
|
+
}
|
842
|
+
if (this.lastFocusedPane === pane) {
|
843
|
+
this.lastFocusedPane = undefined;
|
844
|
+
}
|
845
|
+
assertIsDefined(this.paneview).removePane(pane);
|
846
|
+
const [paneItem] = this.paneItems.splice(index, 1);
|
847
|
+
paneItem.disposable.dispose();
|
848
|
+
}
|
849
|
+
movePane(from, to) {
|
850
|
+
const fromIndex = this.paneItems.findIndex(item => item.pane === from);
|
851
|
+
const toIndex = this.paneItems.findIndex(item => item.pane === to);
|
852
|
+
const fromViewDescriptor = this.viewContainerModel.visibleViewDescriptors[fromIndex];
|
853
|
+
const toViewDescriptor = this.viewContainerModel.visibleViewDescriptors[toIndex];
|
854
|
+
if (fromIndex < 0 || fromIndex >= this.paneItems.length) {
|
855
|
+
return;
|
856
|
+
}
|
857
|
+
if (toIndex < 0 || toIndex >= this.paneItems.length) {
|
858
|
+
return;
|
859
|
+
}
|
860
|
+
const [paneItem] = this.paneItems.splice(fromIndex, 1);
|
861
|
+
this.paneItems.splice(toIndex, 0, paneItem);
|
862
|
+
assertIsDefined(this.paneview).movePane(from, to);
|
863
|
+
this.viewContainerModel.move(fromViewDescriptor.id, toViewDescriptor.id);
|
864
|
+
this.updateTitleArea();
|
865
|
+
}
|
866
|
+
resizePane(pane, size) {
|
867
|
+
assertIsDefined(this.paneview).resizePane(pane, size);
|
868
|
+
}
|
869
|
+
getPaneSize(pane) {
|
870
|
+
return assertIsDefined(this.paneview).getPaneSize(pane);
|
871
|
+
}
|
872
|
+
updateViewHeaders() {
|
873
|
+
if (this.isViewMergedWithContainer()) {
|
874
|
+
if (this.paneItems[0].pane.isExpanded()) {
|
875
|
+
this.lastMergedCollapsedPane = undefined;
|
876
|
+
}
|
877
|
+
else {
|
878
|
+
this.lastMergedCollapsedPane = this.paneItems[0].pane;
|
879
|
+
this.paneItems[0].pane.setExpanded(true);
|
880
|
+
}
|
881
|
+
this.paneItems[0].pane.headerVisible = false;
|
882
|
+
this.paneItems[0].pane.collapsible = true;
|
883
|
+
}
|
884
|
+
else {
|
885
|
+
if (this.paneItems.length === 1) {
|
886
|
+
this.paneItems[0].pane.headerVisible = true;
|
887
|
+
if (this.paneItems[0].pane === this.lastMergedCollapsedPane) {
|
888
|
+
this.paneItems[0].pane.setExpanded(false);
|
889
|
+
}
|
890
|
+
this.paneItems[0].pane.collapsible = false;
|
891
|
+
}
|
892
|
+
else {
|
893
|
+
this.paneItems.forEach(i => {
|
894
|
+
i.pane.headerVisible = true;
|
895
|
+
i.pane.collapsible = true;
|
896
|
+
if (i.pane === this.lastMergedCollapsedPane) {
|
897
|
+
i.pane.setExpanded(false);
|
898
|
+
}
|
899
|
+
});
|
900
|
+
}
|
901
|
+
this.lastMergedCollapsedPane = undefined;
|
902
|
+
}
|
903
|
+
}
|
904
|
+
isViewMergedWithContainer() {
|
905
|
+
if (!(this.options.mergeViewWithContainerWhenSingleView && this.paneItems.length === 1)) {
|
906
|
+
return false;
|
907
|
+
}
|
908
|
+
if (!this.areExtensionsReady) {
|
909
|
+
if (this.visibleViewsCountFromCache === undefined) {
|
910
|
+
return this.paneItems[0].pane.isExpanded();
|
911
|
+
}
|
912
|
+
return this.visibleViewsCountFromCache === 1;
|
913
|
+
}
|
914
|
+
return true;
|
915
|
+
}
|
916
|
+
onDidScrollPane() {
|
917
|
+
for (const pane of this.panes) {
|
918
|
+
pane.onDidScrollRoot();
|
919
|
+
}
|
920
|
+
}
|
921
|
+
onDidSashReset(index) {
|
922
|
+
let firstPane = undefined;
|
923
|
+
let secondPane = undefined;
|
924
|
+
for (let i = index; i >= 0; i--) {
|
925
|
+
if (this.paneItems[i].pane?.isVisible() && this.paneItems[i]?.pane.isExpanded()) {
|
926
|
+
firstPane = this.paneItems[i].pane;
|
927
|
+
break;
|
928
|
+
}
|
929
|
+
}
|
930
|
+
for (let i = index + 1; i < this.paneItems.length; i++) {
|
931
|
+
if (this.paneItems[i].pane?.isVisible() && this.paneItems[i]?.pane.isExpanded()) {
|
932
|
+
secondPane = this.paneItems[i].pane;
|
933
|
+
break;
|
934
|
+
}
|
935
|
+
}
|
936
|
+
if (firstPane && secondPane) {
|
937
|
+
const firstPaneSize = this.getPaneSize(firstPane);
|
938
|
+
const secondPaneSize = this.getPaneSize(secondPane);
|
939
|
+
const newFirstPaneSize = Math.ceil((firstPaneSize + secondPaneSize) / 2);
|
940
|
+
const newSecondPaneSize = Math.floor((firstPaneSize + secondPaneSize) / 2);
|
941
|
+
if (firstPaneSize > secondPaneSize) {
|
942
|
+
this.resizePane(firstPane, newFirstPaneSize);
|
943
|
+
this.resizePane(secondPane, newSecondPaneSize);
|
944
|
+
}
|
945
|
+
else {
|
946
|
+
this.resizePane(secondPane, newSecondPaneSize);
|
947
|
+
this.resizePane(firstPane, newFirstPaneSize);
|
948
|
+
}
|
949
|
+
}
|
950
|
+
}
|
951
|
+
dispose() {
|
952
|
+
super.dispose();
|
953
|
+
this.paneItems.forEach(i => i.disposable.dispose());
|
954
|
+
if (this.paneview) {
|
955
|
+
this.paneview.dispose();
|
956
|
+
}
|
957
|
+
}
|
958
|
+
};
|
959
|
+
ViewPaneContainer = ( __decorate([
|
960
|
+
( __param(2, IInstantiationService)),
|
961
|
+
( __param(3, IConfigurationService)),
|
962
|
+
( __param(4, IWorkbenchLayoutService)),
|
963
|
+
( __param(5, IContextMenuService)),
|
964
|
+
( __param(6, ITelemetryService)),
|
965
|
+
( __param(7, IExtensionService)),
|
966
|
+
( __param(8, IThemeService)),
|
967
|
+
( __param(9, IStorageService)),
|
968
|
+
( __param(10, IWorkspaceContextService)),
|
969
|
+
( __param(11, IViewDescriptorService)),
|
970
|
+
( __param(12, ILogService))
|
971
|
+
], ViewPaneContainer));
|
972
|
+
class ViewPaneContainerAction extends Action2 {
|
973
|
+
constructor(desc) {
|
974
|
+
super(desc);
|
975
|
+
this.desc = desc;
|
976
|
+
}
|
977
|
+
run(accessor, ...args) {
|
978
|
+
const viewPaneContainer = accessor.get(IViewsService).getActiveViewPaneContainerWithId(this.desc.viewPaneContainerId);
|
979
|
+
if (viewPaneContainer) {
|
980
|
+
return this.runInViewPaneContainer(accessor, viewPaneContainer, ...args);
|
981
|
+
}
|
982
|
+
return undefined;
|
983
|
+
}
|
984
|
+
}
|
985
|
+
class MoveViewPosition extends Action2 {
|
986
|
+
constructor(desc, offset) {
|
987
|
+
super(desc);
|
988
|
+
this.offset = offset;
|
989
|
+
}
|
990
|
+
async run(accessor) {
|
991
|
+
const viewDescriptorService = accessor.get(IViewDescriptorService);
|
992
|
+
const contextKeyService = accessor.get(IContextKeyService);
|
993
|
+
const viewId = FocusedViewContext.getValue(contextKeyService);
|
994
|
+
if (viewId === undefined) {
|
995
|
+
return;
|
996
|
+
}
|
997
|
+
const viewContainer = viewDescriptorService.getViewContainerByViewId(viewId);
|
998
|
+
const model = viewDescriptorService.getViewContainerModel(viewContainer);
|
999
|
+
const viewDescriptor = model.visibleViewDescriptors.find(vd => vd.id === viewId);
|
1000
|
+
const currentIndex = model.visibleViewDescriptors.indexOf(viewDescriptor);
|
1001
|
+
if (currentIndex + this.offset < 0 || currentIndex + this.offset >= model.visibleViewDescriptors.length) {
|
1002
|
+
return;
|
1003
|
+
}
|
1004
|
+
const newPosition = model.visibleViewDescriptors[currentIndex + this.offset];
|
1005
|
+
model.move(viewDescriptor.id, newPosition.id);
|
1006
|
+
}
|
1007
|
+
}
|
1008
|
+
registerAction2(class MoveViewUp extends MoveViewPosition {
|
1009
|
+
constructor() {
|
1010
|
+
super({
|
1011
|
+
id: 'views.moveViewUp',
|
1012
|
+
title: ( localize(3545, "Move View Up")),
|
1013
|
+
keybinding: {
|
1014
|
+
primary: KeyChord(KeyMod.CtrlCmd + KeyCode.KeyK, KeyCode.UpArrow),
|
1015
|
+
weight: KeybindingWeight.WorkbenchContrib + 1,
|
1016
|
+
when: ( FocusedViewContext.notEqualsTo(''))
|
1017
|
+
}
|
1018
|
+
}, -1);
|
1019
|
+
}
|
1020
|
+
});
|
1021
|
+
registerAction2(class MoveViewLeft extends MoveViewPosition {
|
1022
|
+
constructor() {
|
1023
|
+
super({
|
1024
|
+
id: 'views.moveViewLeft',
|
1025
|
+
title: ( localize(3546, "Move View Left")),
|
1026
|
+
keybinding: {
|
1027
|
+
primary: KeyChord(KeyMod.CtrlCmd + KeyCode.KeyK, KeyCode.LeftArrow),
|
1028
|
+
weight: KeybindingWeight.WorkbenchContrib + 1,
|
1029
|
+
when: ( FocusedViewContext.notEqualsTo(''))
|
1030
|
+
}
|
1031
|
+
}, -1);
|
1032
|
+
}
|
1033
|
+
});
|
1034
|
+
registerAction2(class MoveViewDown extends MoveViewPosition {
|
1035
|
+
constructor() {
|
1036
|
+
super({
|
1037
|
+
id: 'views.moveViewDown',
|
1038
|
+
title: ( localize(3547, "Move View Down")),
|
1039
|
+
keybinding: {
|
1040
|
+
primary: KeyChord(KeyMod.CtrlCmd + KeyCode.KeyK, KeyCode.DownArrow),
|
1041
|
+
weight: KeybindingWeight.WorkbenchContrib + 1,
|
1042
|
+
when: ( FocusedViewContext.notEqualsTo(''))
|
1043
|
+
}
|
1044
|
+
}, 1);
|
1045
|
+
}
|
1046
|
+
});
|
1047
|
+
registerAction2(class MoveViewRight extends MoveViewPosition {
|
1048
|
+
constructor() {
|
1049
|
+
super({
|
1050
|
+
id: 'views.moveViewRight',
|
1051
|
+
title: ( localize(3548, "Move View Right")),
|
1052
|
+
keybinding: {
|
1053
|
+
primary: KeyChord(KeyMod.CtrlCmd + KeyCode.KeyK, KeyCode.RightArrow),
|
1054
|
+
weight: KeybindingWeight.WorkbenchContrib + 1,
|
1055
|
+
when: ( FocusedViewContext.notEqualsTo(''))
|
1056
|
+
}
|
1057
|
+
}, 1);
|
1058
|
+
}
|
1059
|
+
});
|
1060
|
+
registerAction2(class MoveViews extends Action2 {
|
1061
|
+
constructor() {
|
1062
|
+
super({
|
1063
|
+
id: 'vscode.moveViews',
|
1064
|
+
title: ( localize(3549, "Move Views")),
|
1065
|
+
});
|
1066
|
+
}
|
1067
|
+
async run(accessor, options) {
|
1068
|
+
if (!Array.isArray(options?.viewIds) || typeof options?.destinationId !== 'string') {
|
1069
|
+
return Promise.reject('Invalid arguments');
|
1070
|
+
}
|
1071
|
+
const viewDescriptorService = accessor.get(IViewDescriptorService);
|
1072
|
+
const destination = viewDescriptorService.getViewContainerById(options.destinationId);
|
1073
|
+
if (!destination) {
|
1074
|
+
return;
|
1075
|
+
}
|
1076
|
+
for (const viewId of options.viewIds) {
|
1077
|
+
const viewDescriptor = viewDescriptorService.getViewDescriptorById(viewId);
|
1078
|
+
if (viewDescriptor?.canMoveView) {
|
1079
|
+
viewDescriptorService.moveViewsToContainer([viewDescriptor], destination, ViewVisibilityState.Default, this.desc.id);
|
1080
|
+
}
|
1081
|
+
}
|
1082
|
+
await accessor.get(IViewsService).openViewContainer(destination.id, true);
|
1083
|
+
}
|
1084
|
+
});
|
1085
|
+
|
1086
|
+
export { ViewPaneContainer, ViewPaneContainerAction, ViewsSubMenu };
|