@codingame/monaco-vscode-views-service-override 2.1.4 → 2.2.0-next.2
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/index.d.ts +11 -9
- package/index.js +8 -6
- package/package.json +11 -11
- package/tools/views.d.ts +102 -0
- package/tools/views.js +253 -0
- package/views.d.ts +4 -99
- package/views.js +52 -280
- package/external/rollup-plugin-styles/dist/runtime/inject-css.js +0 -3
- package/vscode/src/vs/base/browser/ui/centered/centeredViewLayout.js +0 -180
- package/vscode/src/vs/base/browser/ui/grid/grid.js +0 -494
- package/vscode/src/vs/base/browser/ui/grid/gridview.css.js +0 -6
- package/vscode/src/vs/base/browser/ui/grid/gridview.js +0 -1112
- package/vscode/src/vs/base/common/codicons.d.ts +0 -579
- package/vscode/src/vs/platform/webview/common/mimeTypes.js +0 -24
- package/vscode/src/vs/platform/webview/common/webviewPortMapping.js +0 -64
- package/vscode/src/vs/workbench/api/browser/viewsExtensionPoint.js +0 -790
- package/vscode/src/vs/workbench/browser/actions/listCommands.js +0 -764
- package/vscode/src/vs/workbench/browser/layout.d.ts +0 -26
- package/vscode/src/vs/workbench/browser/parts/activitybar/activitybarPart.js +0 -612
- package/vscode/src/vs/workbench/browser/parts/activitybar/media/activityaction.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/auxiliarybar/auxiliaryBarPart.js +0 -150
- package/vscode/src/vs/workbench/browser/parts/auxiliarybar/media/auxiliaryBarPart.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/compositeBar.js +0 -605
- package/vscode/src/vs/workbench/browser/parts/compositePart.js +0 -335
- package/vscode/src/vs/workbench/browser/parts/editor/auxiliaryEditorPart.js +0 -223
- package/vscode/src/vs/workbench/browser/parts/editor/editor.contribution.js +0 -1407
- package/vscode/src/vs/workbench/browser/parts/editor/editorConfiguration.js +0 -186
- package/vscode/src/vs/workbench/browser/parts/editor/editorDropTarget.js +0 -511
- package/vscode/src/vs/workbench/browser/parts/editor/editorPane.d.ts +0 -112
- package/vscode/src/vs/workbench/browser/parts/editor/editorPart.js +0 -1020
- package/vscode/src/vs/workbench/browser/parts/editor/editorParts.js +0 -391
- package/vscode/src/vs/workbench/browser/parts/editor/media/editordroptarget.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/media/compositepart.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/media/paneCompositePart.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/paneCompositeBar.js +0 -645
- package/vscode/src/vs/workbench/browser/parts/paneCompositePart.js +0 -379
- package/vscode/src/vs/workbench/browser/parts/paneCompositePartService.js +0 -68
- package/vscode/src/vs/workbench/browser/parts/panel/panelPart.js +0 -146
- package/vscode/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/sidebar/sidebarPart.js +0 -222
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.js +0 -299
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.js +0 -365
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyTree.js +0 -135
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/media/callHierarchy.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditor.contribution.js +0 -17
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditorInputFactory.js +0 -145
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditors.js +0 -214
- package/vscode/src/vs/workbench/contrib/customEditor/browser/media/customEditor.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/customEditor/common/contributedCustomEditors.js +0 -78
- package/vscode/src/vs/workbench/contrib/customEditor/common/customEditorModelManager.js +0 -63
- package/vscode/src/vs/workbench/contrib/customEditor/common/extensionPoint.js +0 -119
- package/vscode/src/vs/workbench/contrib/externalUriOpener/common/externalUriOpener.contribution.js +0 -6
- package/vscode/src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.js +0 -79
- package/vscode/src/vs/workbench/contrib/files/browser/editors/fileEditorHandler.js +0 -74
- package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditor.js +0 -256
- package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditorTracker.js +0 -99
- package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.js +0 -444
- package/vscode/src/vs/workbench/contrib/files/browser/explorerService.js +0 -432
- package/vscode/src/vs/workbench/contrib/files/browser/fileActions.contribution.js +0 -786
- package/vscode/src/vs/workbench/contrib/files/browser/fileCommands.js +0 -488
- package/vscode/src/vs/workbench/contrib/files/browser/files.contribution.js +0 -522
- package/vscode/src/vs/workbench/contrib/files/browser/workspaceWatcher.js +0 -152
- package/vscode/src/vs/workbench/contrib/files/common/dirtyFilesIndicator.js +0 -63
- package/vscode/src/vs/workbench/contrib/languageStatus/browser/languageStatus.contribution.js +0 -409
- package/vscode/src/vs/workbench/contrib/languageStatus/browser/media/languageStatus.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/commands.js +0 -693
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/devCommands.js +0 -240
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditor.contribution.js +0 -77
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorSerializer.js +0 -42
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/colors.js +0 -71
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/conflictActions.js +0 -348
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editorGutter.js +0 -98
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/baseCodeEditorView.js +0 -146
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/codeEditorView.js +0 -105
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/inputCodeEditorView.js +0 -401
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/resultCodeEditorView.js +0 -197
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/fixedZoneWidget.js +0 -41
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/lineAlignment.js +0 -128
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/media/mergeEditor.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/mergeEditor.js +0 -612
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/scrollSynchronizer.js +0 -158
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewModel.js +0 -264
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewZones.js +0 -173
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/media/typeHierarchy.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchy.contribution.js +0 -282
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek.js +0 -360
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyTree.js +0 -133
- package/vscode/src/vs/workbench/contrib/webview/browser/overlayWebview.js +0 -290
- package/vscode/src/vs/workbench/contrib/webview/browser/resourceLoading.js +0 -96
- package/vscode/src/vs/workbench/contrib/webview/browser/themeing.js +0 -88
- package/vscode/src/vs/workbench/contrib/webview/browser/webview.contribution.js +0 -79
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewElement.js +0 -648
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewFindWidget.js +0 -65
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewService.js +0 -59
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewCommands.js +0 -142
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewEditorInputSerializer.js +0 -121
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewPanel.contribution.js +0 -68
- package/vscode/src/vs/workbench/contrib/webviewView/browser/webviewViewPane.js +0 -235
- package/vscode/src/vs/workbench/services/activity/browser/activityService.js +0 -145
- package/vscode/src/vs/workbench/services/editor/browser/editorResolverService.js +0 -670
- package/vscode/src/vs/workbench/services/history/browser/historyService.js +0 -1484
- package/vscode/src/vs/workbench/services/progress/browser/media/progressService.css.js +0 -6
- package/vscode/src/vs/workbench/services/progress/browser/progressService.js +0 -523
- package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorHandler.js +0 -101
- package/vscode/src/vs/workbench/services/views/browser/viewDescriptorService.js +0 -713
- package/vscode/src/vs/workbench/services/views/common/viewContainerModel.js +0 -598
|
@@ -1,598 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { VIEWS_LOG_ID, VIEWS_LOG_NAME, Extensions, defaultViewIcon } from 'vscode/vscode/vs/workbench/common/views';
|
|
3
|
-
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
4
|
-
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
5
|
-
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
6
|
-
import { Disposable, DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
7
|
-
import { Emitter, Event } from 'vscode/vscode/vs/base/common/event';
|
|
8
|
-
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
9
|
-
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
10
|
-
import { coalesce, move } from 'vscode/vscode/vs/base/common/arrays';
|
|
11
|
-
import { isUndefinedOrNull, isUndefined } from 'vscode/vscode/vs/base/common/types';
|
|
12
|
-
import { isEqual } from 'vscode/vscode/vs/base/common/resources';
|
|
13
|
-
import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
|
|
14
|
-
import { ILoggerService } from 'vscode/vscode/vs/platform/log/common/log';
|
|
15
|
-
import { registerAction2, Action2 } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
16
|
-
import { Categories } from 'vscode/vscode/vs/platform/action/common/actionCommonCategories';
|
|
17
|
-
import { IOutputService } from 'vscode/vscode/vs/workbench/services/output/common/output';
|
|
18
|
-
import { CounterSet } from 'vscode/vscode/vs/base/common/map';
|
|
19
|
-
|
|
20
|
-
registerAction2(class extends Action2 {
|
|
21
|
-
constructor() {
|
|
22
|
-
super({
|
|
23
|
-
id: '_workbench.output.showViewsLog',
|
|
24
|
-
title: { value: 'Show Views Log', original: 'Show Views Log' },
|
|
25
|
-
category: Categories.Developer,
|
|
26
|
-
f1: true
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
async run(servicesAccessor) {
|
|
30
|
-
const loggerService = servicesAccessor.get(ILoggerService);
|
|
31
|
-
const outputService = servicesAccessor.get(IOutputService);
|
|
32
|
-
loggerService.setVisibility(VIEWS_LOG_ID, true);
|
|
33
|
-
outputService.showChannel(VIEWS_LOG_ID);
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
function getViewsStateStorageId(viewContainerStorageId) { return `${viewContainerStorageId}.hidden`; }
|
|
37
|
-
let ViewDescriptorsState = class ViewDescriptorsState extends Disposable {
|
|
38
|
-
constructor(viewContainerStorageId, viewContainerName, storageService, loggerService) {
|
|
39
|
-
super();
|
|
40
|
-
this.viewContainerName = viewContainerName;
|
|
41
|
-
this.storageService = storageService;
|
|
42
|
-
this._onDidChangeStoredState = this._register(( new Emitter()));
|
|
43
|
-
this.onDidChangeStoredState = this._onDidChangeStoredState.event;
|
|
44
|
-
this.logger = loggerService.createLogger(VIEWS_LOG_ID, { name: VIEWS_LOG_NAME, hidden: true });
|
|
45
|
-
this.globalViewsStateStorageId = getViewsStateStorageId(viewContainerStorageId);
|
|
46
|
-
this.workspaceViewsStateStorageId = viewContainerStorageId;
|
|
47
|
-
this._register(this.storageService.onDidChangeValue(0 , this.globalViewsStateStorageId, this._register(( new DisposableStore())))(() => this.onDidStorageChange()));
|
|
48
|
-
this.state = this.initialize();
|
|
49
|
-
}
|
|
50
|
-
set(id, state) {
|
|
51
|
-
this.state.set(id, state);
|
|
52
|
-
}
|
|
53
|
-
get(id) {
|
|
54
|
-
return this.state.get(id);
|
|
55
|
-
}
|
|
56
|
-
updateState(viewDescriptors) {
|
|
57
|
-
this.updateWorkspaceState(viewDescriptors);
|
|
58
|
-
this.updateGlobalState(viewDescriptors);
|
|
59
|
-
}
|
|
60
|
-
updateWorkspaceState(viewDescriptors) {
|
|
61
|
-
const storedViewsStates = this.getStoredWorkspaceState();
|
|
62
|
-
for (const viewDescriptor of viewDescriptors) {
|
|
63
|
-
const viewState = this.get(viewDescriptor.id);
|
|
64
|
-
if (viewState) {
|
|
65
|
-
storedViewsStates[viewDescriptor.id] = {
|
|
66
|
-
collapsed: !!viewState.collapsed,
|
|
67
|
-
isHidden: !viewState.visibleWorkspace,
|
|
68
|
-
size: viewState.size,
|
|
69
|
-
order: viewDescriptor.workspace && viewState ? viewState.order : undefined
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
if (( Object.keys(storedViewsStates)).length > 0) {
|
|
74
|
-
this.storageService.store(this.workspaceViewsStateStorageId, JSON.stringify(storedViewsStates), 1 , 1 );
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
this.storageService.remove(this.workspaceViewsStateStorageId, 1 );
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
updateGlobalState(viewDescriptors) {
|
|
81
|
-
const storedGlobalState = this.getStoredGlobalState();
|
|
82
|
-
for (const viewDescriptor of viewDescriptors) {
|
|
83
|
-
const state = this.get(viewDescriptor.id);
|
|
84
|
-
storedGlobalState.set(viewDescriptor.id, {
|
|
85
|
-
id: viewDescriptor.id,
|
|
86
|
-
isHidden: state && viewDescriptor.canToggleVisibility ? !state.visibleGlobal : false,
|
|
87
|
-
order: !viewDescriptor.workspace && state ? state.order : undefined
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
this.setStoredGlobalState(storedGlobalState);
|
|
91
|
-
}
|
|
92
|
-
onDidStorageChange() {
|
|
93
|
-
if (this.globalViewsStatesValue !== this.getStoredGlobalViewsStatesValue() ) {
|
|
94
|
-
this._globalViewsStatesValue = undefined;
|
|
95
|
-
const storedViewsVisibilityStates = this.getStoredGlobalState();
|
|
96
|
-
const storedWorkspaceViewsStates = this.getStoredWorkspaceState();
|
|
97
|
-
const changedStates = [];
|
|
98
|
-
for (const [id, storedState] of storedViewsVisibilityStates) {
|
|
99
|
-
const state = this.get(id);
|
|
100
|
-
if (state) {
|
|
101
|
-
if (state.visibleGlobal !== !storedState.isHidden) {
|
|
102
|
-
if (!storedState.isHidden) {
|
|
103
|
-
this.logger.info(`View visibility state changed: ${id} is now visible`, this.viewContainerName);
|
|
104
|
-
}
|
|
105
|
-
changedStates.push({ id, visible: !storedState.isHidden });
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
const workspaceViewState = storedWorkspaceViewsStates[id];
|
|
110
|
-
this.set(id, {
|
|
111
|
-
active: false,
|
|
112
|
-
visibleGlobal: !storedState.isHidden,
|
|
113
|
-
visibleWorkspace: isUndefined(workspaceViewState?.isHidden) ? undefined : !workspaceViewState?.isHidden,
|
|
114
|
-
collapsed: workspaceViewState?.collapsed,
|
|
115
|
-
order: workspaceViewState?.order,
|
|
116
|
-
size: workspaceViewState?.size,
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
if (changedStates.length) {
|
|
121
|
-
this._onDidChangeStoredState.fire(changedStates);
|
|
122
|
-
for (const changedState of changedStates) {
|
|
123
|
-
const state = this.get(changedState.id);
|
|
124
|
-
if (state) {
|
|
125
|
-
state.visibleGlobal = changedState.visible;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
initialize() {
|
|
132
|
-
const viewStates = ( new Map());
|
|
133
|
-
const workspaceViewsStates = this.getStoredWorkspaceState();
|
|
134
|
-
for (const id of ( Object.keys(workspaceViewsStates))) {
|
|
135
|
-
const workspaceViewState = workspaceViewsStates[id];
|
|
136
|
-
viewStates.set(id, {
|
|
137
|
-
active: false,
|
|
138
|
-
visibleGlobal: undefined,
|
|
139
|
-
visibleWorkspace: isUndefined(workspaceViewState.isHidden) ? undefined : !workspaceViewState.isHidden,
|
|
140
|
-
collapsed: workspaceViewState.collapsed,
|
|
141
|
-
order: workspaceViewState.order,
|
|
142
|
-
size: workspaceViewState.size,
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
const value = this.storageService.get(this.globalViewsStateStorageId, 1 , '[]');
|
|
146
|
-
const { state: workspaceVisibilityStates } = this.parseStoredGlobalState(value);
|
|
147
|
-
if (workspaceVisibilityStates.size > 0) {
|
|
148
|
-
for (const { id, isHidden } of ( workspaceVisibilityStates.values())) {
|
|
149
|
-
const viewState = viewStates.get(id);
|
|
150
|
-
if (viewState) {
|
|
151
|
-
if (isUndefined(viewState.visibleWorkspace)) {
|
|
152
|
-
viewState.visibleWorkspace = !isHidden;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
viewStates.set(id, {
|
|
157
|
-
active: false,
|
|
158
|
-
collapsed: undefined,
|
|
159
|
-
visibleGlobal: undefined,
|
|
160
|
-
visibleWorkspace: !isHidden,
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
this.storageService.remove(this.globalViewsStateStorageId, 1 );
|
|
165
|
-
}
|
|
166
|
-
const { state, hasDuplicates } = this.parseStoredGlobalState(this.globalViewsStatesValue);
|
|
167
|
-
if (hasDuplicates) {
|
|
168
|
-
this.setStoredGlobalState(state);
|
|
169
|
-
}
|
|
170
|
-
for (const { id, isHidden, order } of ( state.values())) {
|
|
171
|
-
const viewState = viewStates.get(id);
|
|
172
|
-
if (viewState) {
|
|
173
|
-
viewState.visibleGlobal = !isHidden;
|
|
174
|
-
if (!isUndefined(order)) {
|
|
175
|
-
viewState.order = order;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
else {
|
|
179
|
-
viewStates.set(id, {
|
|
180
|
-
active: false,
|
|
181
|
-
visibleGlobal: !isHidden,
|
|
182
|
-
order,
|
|
183
|
-
collapsed: undefined,
|
|
184
|
-
visibleWorkspace: undefined,
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
return viewStates;
|
|
189
|
-
}
|
|
190
|
-
getStoredWorkspaceState() {
|
|
191
|
-
return JSON.parse(this.storageService.get(this.workspaceViewsStateStorageId, 1 , '{}'));
|
|
192
|
-
}
|
|
193
|
-
getStoredGlobalState() {
|
|
194
|
-
return this.parseStoredGlobalState(this.globalViewsStatesValue).state;
|
|
195
|
-
}
|
|
196
|
-
setStoredGlobalState(storedGlobalState) {
|
|
197
|
-
this.globalViewsStatesValue = JSON.stringify([...( storedGlobalState.values())]);
|
|
198
|
-
}
|
|
199
|
-
parseStoredGlobalState(value) {
|
|
200
|
-
const storedValue = JSON.parse(value);
|
|
201
|
-
let hasDuplicates = false;
|
|
202
|
-
const state = storedValue.reduce((result, storedState) => {
|
|
203
|
-
if (typeof storedState === 'string' ) {
|
|
204
|
-
hasDuplicates = hasDuplicates || ( result.has(storedState));
|
|
205
|
-
result.set(storedState, { id: storedState, isHidden: true });
|
|
206
|
-
}
|
|
207
|
-
else {
|
|
208
|
-
hasDuplicates = hasDuplicates || ( result.has(storedState.id));
|
|
209
|
-
result.set(storedState.id, storedState);
|
|
210
|
-
}
|
|
211
|
-
return result;
|
|
212
|
-
}, ( new Map()));
|
|
213
|
-
return { state, hasDuplicates };
|
|
214
|
-
}
|
|
215
|
-
get globalViewsStatesValue() {
|
|
216
|
-
if (!this._globalViewsStatesValue) {
|
|
217
|
-
this._globalViewsStatesValue = this.getStoredGlobalViewsStatesValue();
|
|
218
|
-
}
|
|
219
|
-
return this._globalViewsStatesValue;
|
|
220
|
-
}
|
|
221
|
-
set globalViewsStatesValue(globalViewsStatesValue) {
|
|
222
|
-
if (this.globalViewsStatesValue !== globalViewsStatesValue) {
|
|
223
|
-
this._globalViewsStatesValue = globalViewsStatesValue;
|
|
224
|
-
this.setStoredGlobalViewsStatesValue(globalViewsStatesValue);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
getStoredGlobalViewsStatesValue() {
|
|
228
|
-
return this.storageService.get(this.globalViewsStateStorageId, 0 , '[]');
|
|
229
|
-
}
|
|
230
|
-
setStoredGlobalViewsStatesValue(value) {
|
|
231
|
-
this.storageService.store(this.globalViewsStateStorageId, value, 0 , 0 );
|
|
232
|
-
}
|
|
233
|
-
};
|
|
234
|
-
ViewDescriptorsState = ( __decorate([
|
|
235
|
-
( __param(2, IStorageService)),
|
|
236
|
-
( __param(3, ILoggerService))
|
|
237
|
-
], ViewDescriptorsState));
|
|
238
|
-
let ViewContainerModel = class ViewContainerModel extends Disposable {
|
|
239
|
-
get title() { return this._title; }
|
|
240
|
-
get icon() { return this._icon; }
|
|
241
|
-
get keybindingId() { return this._keybindingId; }
|
|
242
|
-
get allViewDescriptors() { return ( this.viewDescriptorItems.map(item => item.viewDescriptor)); }
|
|
243
|
-
get activeViewDescriptors() { return ( this.viewDescriptorItems.filter(item => item.state.active).map(item => item.viewDescriptor)); }
|
|
244
|
-
get visibleViewDescriptors() { return ( this.viewDescriptorItems.filter(item => this.isViewDescriptorVisible(item)).map(item => item.viewDescriptor)); }
|
|
245
|
-
constructor(viewContainer, instantiationService, contextKeyService, loggerService) {
|
|
246
|
-
super();
|
|
247
|
-
this.viewContainer = viewContainer;
|
|
248
|
-
this.contextKeyService = contextKeyService;
|
|
249
|
-
this.contextKeys = ( new CounterSet());
|
|
250
|
-
this.viewDescriptorItems = [];
|
|
251
|
-
this._onDidChangeContainerInfo = this._register(( new Emitter()));
|
|
252
|
-
this.onDidChangeContainerInfo = this._onDidChangeContainerInfo.event;
|
|
253
|
-
this._onDidChangeAllViewDescriptors = this._register(( new Emitter()));
|
|
254
|
-
this.onDidChangeAllViewDescriptors = this._onDidChangeAllViewDescriptors.event;
|
|
255
|
-
this._onDidChangeActiveViewDescriptors = this._register(( new Emitter()));
|
|
256
|
-
this.onDidChangeActiveViewDescriptors = this._onDidChangeActiveViewDescriptors.event;
|
|
257
|
-
this._onDidAddVisibleViewDescriptors = this._register(( new Emitter()));
|
|
258
|
-
this.onDidAddVisibleViewDescriptors = this._onDidAddVisibleViewDescriptors.event;
|
|
259
|
-
this._onDidRemoveVisibleViewDescriptors = this._register(( new Emitter()));
|
|
260
|
-
this.onDidRemoveVisibleViewDescriptors = this._onDidRemoveVisibleViewDescriptors.event;
|
|
261
|
-
this._onDidMoveVisibleViewDescriptors = this._register(( new Emitter()));
|
|
262
|
-
this.onDidMoveVisibleViewDescriptors = this._onDidMoveVisibleViewDescriptors.event;
|
|
263
|
-
this.logger = loggerService.createLogger(VIEWS_LOG_ID, { name: VIEWS_LOG_NAME, hidden: true });
|
|
264
|
-
this._register(Event.filter(contextKeyService.onDidChangeContext, e => e.affectsSome(this.contextKeys))(() => this.onDidChangeContext()));
|
|
265
|
-
this.viewDescriptorsState = this._register(instantiationService.createInstance(ViewDescriptorsState, viewContainer.storageId || `${viewContainer.id}.state`, typeof viewContainer.title === 'string' ? viewContainer.title : viewContainer.title.original));
|
|
266
|
-
this._register(this.viewDescriptorsState.onDidChangeStoredState(items => this.updateVisibility(items)));
|
|
267
|
-
this.updateContainerInfo();
|
|
268
|
-
}
|
|
269
|
-
updateContainerInfo() {
|
|
270
|
-
const useDefaultContainerInfo = this.viewContainer.alwaysUseContainerInfo || this.visibleViewDescriptors.length === 0 || ( this.visibleViewDescriptors.some(v => ( Registry.as(Extensions.ViewsRegistry)).getViewContainer(v.id) === this.viewContainer));
|
|
271
|
-
const title = useDefaultContainerInfo ? (typeof this.viewContainer.title === 'string' ? this.viewContainer.title : this.viewContainer.title.value) : this.visibleViewDescriptors[0]?.containerTitle || this.visibleViewDescriptors[0]?.name?.value || '';
|
|
272
|
-
let titleChanged = false;
|
|
273
|
-
if (this._title !== title) {
|
|
274
|
-
this._title = title;
|
|
275
|
-
titleChanged = true;
|
|
276
|
-
}
|
|
277
|
-
const icon = useDefaultContainerInfo ? this.viewContainer.icon : this.visibleViewDescriptors[0]?.containerIcon || defaultViewIcon;
|
|
278
|
-
let iconChanged = false;
|
|
279
|
-
if (!this.isEqualIcon(icon)) {
|
|
280
|
-
this._icon = icon;
|
|
281
|
-
iconChanged = true;
|
|
282
|
-
}
|
|
283
|
-
const keybindingId = this.viewContainer.openCommandActionDescriptor?.id ?? this.activeViewDescriptors.find(v => v.openCommandActionDescriptor)?.openCommandActionDescriptor?.id;
|
|
284
|
-
let keybindingIdChanged = false;
|
|
285
|
-
if (this._keybindingId !== keybindingId) {
|
|
286
|
-
this._keybindingId = keybindingId;
|
|
287
|
-
keybindingIdChanged = true;
|
|
288
|
-
}
|
|
289
|
-
if (titleChanged || iconChanged || keybindingIdChanged) {
|
|
290
|
-
this._onDidChangeContainerInfo.fire({ title: titleChanged, icon: iconChanged, keybindingId: keybindingIdChanged });
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
isEqualIcon(icon) {
|
|
294
|
-
if (URI.isUri(icon)) {
|
|
295
|
-
return URI.isUri(this._icon) && isEqual(icon, this._icon);
|
|
296
|
-
}
|
|
297
|
-
else if (ThemeIcon.isThemeIcon(icon)) {
|
|
298
|
-
return ThemeIcon.isThemeIcon(this._icon) && ThemeIcon.isEqual(icon, this._icon);
|
|
299
|
-
}
|
|
300
|
-
return icon === this._icon;
|
|
301
|
-
}
|
|
302
|
-
isVisible(id) {
|
|
303
|
-
const viewDescriptorItem = this.viewDescriptorItems.find(v => v.viewDescriptor.id === id);
|
|
304
|
-
if (!viewDescriptorItem) {
|
|
305
|
-
throw new Error(`Unknown view ${id}`);
|
|
306
|
-
}
|
|
307
|
-
return this.isViewDescriptorVisible(viewDescriptorItem);
|
|
308
|
-
}
|
|
309
|
-
setVisible(id, visible) {
|
|
310
|
-
this.updateVisibility([{ id, visible }]);
|
|
311
|
-
}
|
|
312
|
-
updateVisibility(viewDescriptors) {
|
|
313
|
-
const viewDescriptorItemsToHide = coalesce(( viewDescriptors.filter(({ visible }) => !visible)
|
|
314
|
-
.map(({ id }) => this.findAndIgnoreIfNotFound(id))));
|
|
315
|
-
const removed = [];
|
|
316
|
-
for (const { viewDescriptorItem, visibleIndex } of viewDescriptorItemsToHide) {
|
|
317
|
-
if (this.updateViewDescriptorItemVisibility(viewDescriptorItem, false)) {
|
|
318
|
-
removed.push({ viewDescriptor: viewDescriptorItem.viewDescriptor, index: visibleIndex });
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
if (removed.length) {
|
|
322
|
-
this.broadCastRemovedVisibleViewDescriptors(removed);
|
|
323
|
-
}
|
|
324
|
-
const added = [];
|
|
325
|
-
for (const { id, visible } of viewDescriptors) {
|
|
326
|
-
if (!visible) {
|
|
327
|
-
continue;
|
|
328
|
-
}
|
|
329
|
-
const foundViewDescriptor = this.findAndIgnoreIfNotFound(id);
|
|
330
|
-
if (!foundViewDescriptor) {
|
|
331
|
-
continue;
|
|
332
|
-
}
|
|
333
|
-
const { viewDescriptorItem, visibleIndex } = foundViewDescriptor;
|
|
334
|
-
if (this.updateViewDescriptorItemVisibility(viewDescriptorItem, true)) {
|
|
335
|
-
added.push({ index: visibleIndex, viewDescriptor: viewDescriptorItem.viewDescriptor, size: viewDescriptorItem.state.size, collapsed: !!viewDescriptorItem.state.collapsed });
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
if (added.length) {
|
|
339
|
-
this.broadCastAddedVisibleViewDescriptors(added);
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
updateViewDescriptorItemVisibility(viewDescriptorItem, visible) {
|
|
343
|
-
if (!viewDescriptorItem.viewDescriptor.canToggleVisibility) {
|
|
344
|
-
return false;
|
|
345
|
-
}
|
|
346
|
-
if (this.isViewDescriptorVisibleWhenActive(viewDescriptorItem) === visible) {
|
|
347
|
-
return false;
|
|
348
|
-
}
|
|
349
|
-
if (viewDescriptorItem.viewDescriptor.workspace) {
|
|
350
|
-
viewDescriptorItem.state.visibleWorkspace = visible;
|
|
351
|
-
}
|
|
352
|
-
else {
|
|
353
|
-
viewDescriptorItem.state.visibleGlobal = visible;
|
|
354
|
-
if (visible) {
|
|
355
|
-
this.logger.info(`Showing view ${viewDescriptorItem.viewDescriptor.id} in the container ${this.viewContainer.id}`);
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
return this.isViewDescriptorVisible(viewDescriptorItem) === visible;
|
|
359
|
-
}
|
|
360
|
-
isCollapsed(id) {
|
|
361
|
-
return !!this.find(id).viewDescriptorItem.state.collapsed;
|
|
362
|
-
}
|
|
363
|
-
setCollapsed(id, collapsed) {
|
|
364
|
-
const { viewDescriptorItem } = this.find(id);
|
|
365
|
-
if (viewDescriptorItem.state.collapsed !== collapsed) {
|
|
366
|
-
viewDescriptorItem.state.collapsed = collapsed;
|
|
367
|
-
}
|
|
368
|
-
this.viewDescriptorsState.updateState(this.allViewDescriptors);
|
|
369
|
-
}
|
|
370
|
-
getSize(id) {
|
|
371
|
-
return this.find(id).viewDescriptorItem.state.size;
|
|
372
|
-
}
|
|
373
|
-
setSizes(newSizes) {
|
|
374
|
-
for (const { id, size } of newSizes) {
|
|
375
|
-
const { viewDescriptorItem } = this.find(id);
|
|
376
|
-
if (viewDescriptorItem.state.size !== size) {
|
|
377
|
-
viewDescriptorItem.state.size = size;
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
this.viewDescriptorsState.updateState(this.allViewDescriptors);
|
|
381
|
-
}
|
|
382
|
-
move(from, to) {
|
|
383
|
-
const fromIndex = this.viewDescriptorItems.findIndex(v => v.viewDescriptor.id === from);
|
|
384
|
-
const toIndex = this.viewDescriptorItems.findIndex(v => v.viewDescriptor.id === to);
|
|
385
|
-
const fromViewDescriptor = this.viewDescriptorItems[fromIndex];
|
|
386
|
-
const toViewDescriptor = this.viewDescriptorItems[toIndex];
|
|
387
|
-
move(this.viewDescriptorItems, fromIndex, toIndex);
|
|
388
|
-
for (let index = 0; index < this.viewDescriptorItems.length; index++) {
|
|
389
|
-
this.viewDescriptorItems[index].state.order = index;
|
|
390
|
-
}
|
|
391
|
-
this.broadCastMovedViewDescriptors({ index: fromIndex, viewDescriptor: fromViewDescriptor.viewDescriptor }, { index: toIndex, viewDescriptor: toViewDescriptor.viewDescriptor });
|
|
392
|
-
}
|
|
393
|
-
add(addedViewDescriptorStates) {
|
|
394
|
-
const addedItems = [];
|
|
395
|
-
for (const addedViewDescriptorState of addedViewDescriptorStates) {
|
|
396
|
-
const viewDescriptor = addedViewDescriptorState.viewDescriptor;
|
|
397
|
-
if (viewDescriptor.when) {
|
|
398
|
-
for (const key of ( viewDescriptor.when.keys())) {
|
|
399
|
-
this.contextKeys.add(key);
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
let state = this.viewDescriptorsState.get(viewDescriptor.id);
|
|
403
|
-
if (state) {
|
|
404
|
-
if (viewDescriptor.workspace) {
|
|
405
|
-
state.visibleWorkspace = isUndefinedOrNull(addedViewDescriptorState.visible) ? (isUndefinedOrNull(state.visibleWorkspace) ? !viewDescriptor.hideByDefault : state.visibleWorkspace) : addedViewDescriptorState.visible;
|
|
406
|
-
}
|
|
407
|
-
else {
|
|
408
|
-
const isVisible = state.visibleGlobal;
|
|
409
|
-
state.visibleGlobal = isUndefinedOrNull(addedViewDescriptorState.visible) ? (isUndefinedOrNull(state.visibleGlobal) ? !viewDescriptor.hideByDefault : state.visibleGlobal) : addedViewDescriptorState.visible;
|
|
410
|
-
if (state.visibleGlobal && !isVisible) {
|
|
411
|
-
this.logger.info(`Added view ${viewDescriptor.id} in the container ${this.viewContainer.id} and showing it.`, `${isVisible}`, `${viewDescriptor.hideByDefault}`, `${addedViewDescriptorState.visible}`);
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
state.collapsed = isUndefinedOrNull(addedViewDescriptorState.collapsed) ? (isUndefinedOrNull(state.collapsed) ? !!viewDescriptor.collapsed : state.collapsed) : addedViewDescriptorState.collapsed;
|
|
415
|
-
}
|
|
416
|
-
else {
|
|
417
|
-
state = {
|
|
418
|
-
active: false,
|
|
419
|
-
visibleGlobal: isUndefinedOrNull(addedViewDescriptorState.visible) ? !viewDescriptor.hideByDefault : addedViewDescriptorState.visible,
|
|
420
|
-
visibleWorkspace: isUndefinedOrNull(addedViewDescriptorState.visible) ? !viewDescriptor.hideByDefault : addedViewDescriptorState.visible,
|
|
421
|
-
collapsed: isUndefinedOrNull(addedViewDescriptorState.collapsed) ? !!viewDescriptor.collapsed : addedViewDescriptorState.collapsed,
|
|
422
|
-
};
|
|
423
|
-
}
|
|
424
|
-
this.viewDescriptorsState.set(viewDescriptor.id, state);
|
|
425
|
-
state.active = this.contextKeyService.contextMatchesRules(viewDescriptor.when);
|
|
426
|
-
addedItems.push({ viewDescriptor, state });
|
|
427
|
-
}
|
|
428
|
-
this.viewDescriptorItems.push(...addedItems);
|
|
429
|
-
this.viewDescriptorItems.sort(this.compareViewDescriptors.bind(this));
|
|
430
|
-
this._onDidChangeAllViewDescriptors.fire({ added: ( addedItems.map(({ viewDescriptor }) => viewDescriptor)), removed: [] });
|
|
431
|
-
const addedActiveItems = [];
|
|
432
|
-
for (const viewDescriptorItem of addedItems) {
|
|
433
|
-
if (viewDescriptorItem.state.active) {
|
|
434
|
-
addedActiveItems.push({ viewDescriptorItem, visible: this.isViewDescriptorVisible(viewDescriptorItem) });
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
if (addedActiveItems.length) {
|
|
438
|
-
this._onDidChangeActiveViewDescriptors.fire(({ added: ( addedActiveItems.map(({ viewDescriptorItem }) => viewDescriptorItem.viewDescriptor)), removed: [] }));
|
|
439
|
-
}
|
|
440
|
-
const addedVisibleDescriptors = [];
|
|
441
|
-
for (const { viewDescriptorItem, visible } of addedActiveItems) {
|
|
442
|
-
if (visible && this.isViewDescriptorVisible(viewDescriptorItem)) {
|
|
443
|
-
const { visibleIndex } = this.find(viewDescriptorItem.viewDescriptor.id);
|
|
444
|
-
addedVisibleDescriptors.push({ index: visibleIndex, viewDescriptor: viewDescriptorItem.viewDescriptor, size: viewDescriptorItem.state.size, collapsed: !!viewDescriptorItem.state.collapsed });
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
this.broadCastAddedVisibleViewDescriptors(addedVisibleDescriptors);
|
|
448
|
-
}
|
|
449
|
-
remove(viewDescriptors) {
|
|
450
|
-
const removed = [];
|
|
451
|
-
const removedItems = [];
|
|
452
|
-
const removedActiveDescriptors = [];
|
|
453
|
-
const removedVisibleDescriptors = [];
|
|
454
|
-
for (const viewDescriptor of viewDescriptors) {
|
|
455
|
-
if (viewDescriptor.when) {
|
|
456
|
-
for (const key of ( viewDescriptor.when.keys())) {
|
|
457
|
-
this.contextKeys.delete(key);
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
const index = this.viewDescriptorItems.findIndex(i => i.viewDescriptor.id === viewDescriptor.id);
|
|
461
|
-
if (index !== -1) {
|
|
462
|
-
removed.push(viewDescriptor);
|
|
463
|
-
const viewDescriptorItem = this.viewDescriptorItems[index];
|
|
464
|
-
if (viewDescriptorItem.state.active) {
|
|
465
|
-
removedActiveDescriptors.push(viewDescriptorItem.viewDescriptor);
|
|
466
|
-
}
|
|
467
|
-
if (this.isViewDescriptorVisible(viewDescriptorItem)) {
|
|
468
|
-
const { visibleIndex } = this.find(viewDescriptorItem.viewDescriptor.id);
|
|
469
|
-
removedVisibleDescriptors.push({ index: visibleIndex, viewDescriptor: viewDescriptorItem.viewDescriptor });
|
|
470
|
-
}
|
|
471
|
-
removedItems.push(viewDescriptorItem);
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
removedItems.forEach(item => this.viewDescriptorItems.splice(this.viewDescriptorItems.indexOf(item), 1));
|
|
475
|
-
this.broadCastRemovedVisibleViewDescriptors(removedVisibleDescriptors);
|
|
476
|
-
if (removedActiveDescriptors.length) {
|
|
477
|
-
this._onDidChangeActiveViewDescriptors.fire(({ added: [], removed: removedActiveDescriptors }));
|
|
478
|
-
}
|
|
479
|
-
if (removed.length) {
|
|
480
|
-
this._onDidChangeAllViewDescriptors.fire({ added: [], removed });
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
onDidChangeContext() {
|
|
484
|
-
const addedActiveItems = [];
|
|
485
|
-
const removedActiveItems = [];
|
|
486
|
-
for (const item of this.viewDescriptorItems) {
|
|
487
|
-
const wasActive = item.state.active;
|
|
488
|
-
const isActive = this.contextKeyService.contextMatchesRules(item.viewDescriptor.when);
|
|
489
|
-
if (wasActive !== isActive) {
|
|
490
|
-
if (isActive) {
|
|
491
|
-
addedActiveItems.push({ item, visibleWhenActive: this.isViewDescriptorVisibleWhenActive(item) });
|
|
492
|
-
}
|
|
493
|
-
else {
|
|
494
|
-
removedActiveItems.push(item);
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
const removedVisibleDescriptors = [];
|
|
499
|
-
for (const item of removedActiveItems) {
|
|
500
|
-
if (this.isViewDescriptorVisible(item)) {
|
|
501
|
-
const { visibleIndex } = this.find(item.viewDescriptor.id);
|
|
502
|
-
removedVisibleDescriptors.push({ index: visibleIndex, viewDescriptor: item.viewDescriptor });
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
removedActiveItems.forEach(item => item.state.active = false);
|
|
506
|
-
addedActiveItems.forEach(({ item }) => item.state.active = true);
|
|
507
|
-
this.broadCastRemovedVisibleViewDescriptors(removedVisibleDescriptors);
|
|
508
|
-
if (addedActiveItems.length || removedActiveItems.length) {
|
|
509
|
-
this._onDidChangeActiveViewDescriptors.fire(({ added: ( addedActiveItems.map(({ item }) => item.viewDescriptor)), removed: ( removedActiveItems.map(item => item.viewDescriptor)) }));
|
|
510
|
-
}
|
|
511
|
-
const addedVisibleDescriptors = [];
|
|
512
|
-
for (const { item, visibleWhenActive } of addedActiveItems) {
|
|
513
|
-
if (visibleWhenActive && this.isViewDescriptorVisible(item)) {
|
|
514
|
-
const { visibleIndex } = this.find(item.viewDescriptor.id);
|
|
515
|
-
addedVisibleDescriptors.push({ index: visibleIndex, viewDescriptor: item.viewDescriptor, size: item.state.size, collapsed: !!item.state.collapsed });
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
this.broadCastAddedVisibleViewDescriptors(addedVisibleDescriptors);
|
|
519
|
-
}
|
|
520
|
-
broadCastAddedVisibleViewDescriptors(added) {
|
|
521
|
-
if (added.length) {
|
|
522
|
-
this._onDidAddVisibleViewDescriptors.fire(added.sort((a, b) => a.index - b.index));
|
|
523
|
-
this.updateState(`Added views:${( added.map(v => v.viewDescriptor.id)).join(',')} in ${this.viewContainer.id}`);
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
broadCastRemovedVisibleViewDescriptors(removed) {
|
|
527
|
-
if (removed.length) {
|
|
528
|
-
this._onDidRemoveVisibleViewDescriptors.fire(removed.sort((a, b) => b.index - a.index));
|
|
529
|
-
this.updateState(`Removed views:${( removed.map(v => v.viewDescriptor.id)).join(',')} from ${this.viewContainer.id}`);
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
broadCastMovedViewDescriptors(from, to) {
|
|
533
|
-
this._onDidMoveVisibleViewDescriptors.fire({ from, to });
|
|
534
|
-
this.updateState(`Moved view ${from.viewDescriptor.id} to ${to.viewDescriptor.id} in ${this.viewContainer.id}`);
|
|
535
|
-
}
|
|
536
|
-
updateState(reason) {
|
|
537
|
-
this.logger.info(reason);
|
|
538
|
-
this.viewDescriptorsState.updateState(this.allViewDescriptors);
|
|
539
|
-
this.updateContainerInfo();
|
|
540
|
-
}
|
|
541
|
-
isViewDescriptorVisible(viewDescriptorItem) {
|
|
542
|
-
if (!viewDescriptorItem.state.active) {
|
|
543
|
-
return false;
|
|
544
|
-
}
|
|
545
|
-
return this.isViewDescriptorVisibleWhenActive(viewDescriptorItem);
|
|
546
|
-
}
|
|
547
|
-
isViewDescriptorVisibleWhenActive(viewDescriptorItem) {
|
|
548
|
-
if (viewDescriptorItem.viewDescriptor.workspace) {
|
|
549
|
-
return !!viewDescriptorItem.state.visibleWorkspace;
|
|
550
|
-
}
|
|
551
|
-
return !!viewDescriptorItem.state.visibleGlobal;
|
|
552
|
-
}
|
|
553
|
-
find(id) {
|
|
554
|
-
const result = this.findAndIgnoreIfNotFound(id);
|
|
555
|
-
if (result) {
|
|
556
|
-
return result;
|
|
557
|
-
}
|
|
558
|
-
throw new Error(`view descriptor ${id} not found`);
|
|
559
|
-
}
|
|
560
|
-
findAndIgnoreIfNotFound(id) {
|
|
561
|
-
for (let i = 0, visibleIndex = 0; i < this.viewDescriptorItems.length; i++) {
|
|
562
|
-
const viewDescriptorItem = this.viewDescriptorItems[i];
|
|
563
|
-
if (viewDescriptorItem.viewDescriptor.id === id) {
|
|
564
|
-
return { index: i, visibleIndex, viewDescriptorItem: viewDescriptorItem };
|
|
565
|
-
}
|
|
566
|
-
if (this.isViewDescriptorVisible(viewDescriptorItem)) {
|
|
567
|
-
visibleIndex++;
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
return undefined;
|
|
571
|
-
}
|
|
572
|
-
compareViewDescriptors(a, b) {
|
|
573
|
-
if (a.viewDescriptor.id === b.viewDescriptor.id) {
|
|
574
|
-
return 0;
|
|
575
|
-
}
|
|
576
|
-
return (this.getViewOrder(a) - this.getViewOrder(b)) || this.getGroupOrderResult(a.viewDescriptor, b.viewDescriptor);
|
|
577
|
-
}
|
|
578
|
-
getViewOrder(viewDescriptorItem) {
|
|
579
|
-
const viewOrder = typeof viewDescriptorItem.state.order === 'number' ? viewDescriptorItem.state.order : viewDescriptorItem.viewDescriptor.order;
|
|
580
|
-
return typeof viewOrder === 'number' ? viewOrder : Number.MAX_VALUE;
|
|
581
|
-
}
|
|
582
|
-
getGroupOrderResult(a, b) {
|
|
583
|
-
if (!a.group || !b.group) {
|
|
584
|
-
return 0;
|
|
585
|
-
}
|
|
586
|
-
if (a.group === b.group) {
|
|
587
|
-
return 0;
|
|
588
|
-
}
|
|
589
|
-
return a.group < b.group ? -1 : 1;
|
|
590
|
-
}
|
|
591
|
-
};
|
|
592
|
-
ViewContainerModel = ( __decorate([
|
|
593
|
-
( __param(1, IInstantiationService)),
|
|
594
|
-
( __param(2, IContextKeyService)),
|
|
595
|
-
( __param(3, ILoggerService))
|
|
596
|
-
], ViewContainerModel));
|
|
597
|
-
|
|
598
|
-
export { ViewContainerModel, getViewsStateStorageId };
|