Base resource viewer editor (#12039)

* Base resource viewer editor

* Use table more directly

* Dispose listeners

* Fix strict compile

* undo

* More strict fixes

* Remove theming logic

* comments

* more fixes

* cleanup

* Remove actions contribution
This commit is contained in:
Charles Gagnon
2020-09-02 13:02:58 -07:00
committed by GitHub
parent c982ea338d
commit e6d250c640
6 changed files with 337 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { EditorDescriptor, Extensions as EditorExtensions, IEditorRegistry } from 'vs/workbench/browser/editor';
import { Registry } from 'vs/platform/registry/common/platform';
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
import { ResourceViewerEditor } from 'sql/workbench/contrib/resourceViewer/browser/resourceViewerEditor';
import { ResourceViewerInput } from 'sql/workbench/browser/editor/resourceViewer/resourceViewerInput';
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
import { ServicesAccessor, IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IEditorService, ACTIVE_GROUP } from 'vs/workbench/services/editor/common/editorService';
CommandsRegistry.registerCommand({
id: 'resourceViewer.newResourceViewer',
handler: (accessor: ServicesAccessor, ...args: any[]): void => {
const instantiationService: IInstantiationService = accessor.get(IInstantiationService);
const editorService: IEditorService = accessor.get(IEditorService);
const resourceViewerInput = instantiationService.createInstance(ResourceViewerInput);
editorService.openEditor(resourceViewerInput, { pinned: true }, ACTIVE_GROUP);
}
});
const resourceViewerDescriptor = EditorDescriptor.create(
ResourceViewerEditor,
ResourceViewerEditor.ID,
'ResourceViewerEditor'
);
Registry.as<IEditorRegistry>(EditorExtensions.Editors)
.registerEditor(resourceViewerDescriptor, [new SyncDescriptor(ResourceViewerInput)]);