mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-23 09:35:39 -05:00
Merge from vscode a4177f50c475fc0fa278a78235e3bee9ffdec781 (#8649)
* Merge from vscode a4177f50c475fc0fa278a78235e3bee9ffdec781 * distro * fix tests
This commit is contained in:
@@ -19,9 +19,9 @@ import {
|
||||
import { IObjectExplorerService } from 'sql/workbench/services/objectExplorer/browser/objectExplorerService';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { ITree } from 'vs/base/parts/tree/browser/tree';
|
||||
import { ViewletPane, IViewletPaneOptions } from 'vs/workbench/browser/parts/views/paneViewlet';
|
||||
import { ViewPane, IViewPaneOptions } from 'vs/workbench/browser/parts/views/viewPaneContainer';
|
||||
|
||||
export class ConnectionViewletPanel extends ViewletPane {
|
||||
export class ConnectionViewletPanel extends ViewPane {
|
||||
|
||||
public static readonly ID = 'dataExplorer.servers';
|
||||
|
||||
@@ -40,7 +40,7 @@ export class ConnectionViewletPanel extends ViewletPane {
|
||||
@IObjectExplorerService private readonly objectExplorerService: IObjectExplorerService,
|
||||
@IContextKeyService contextKeyService: IContextKeyService
|
||||
) {
|
||||
super({ ...(options as IViewletPaneOptions), ariaHeaderLabel: options.title }, keybindingService, contextMenuService, configurationService, contextKeyService);
|
||||
super({ ...(options as IViewPaneOptions), ariaHeaderLabel: options.title }, keybindingService, contextMenuService, configurationService, contextKeyService);
|
||||
this._addServerAction = this.instantiationService.createInstance(AddServerAction,
|
||||
AddServerAction.ID,
|
||||
AddServerAction.LABEL);
|
||||
|
||||
@@ -11,7 +11,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { ViewContainerViewlet, IViewletViewOptions } from 'vs/workbench/browser/parts/views/viewsViewlet';
|
||||
import { IViewletViewOptions } from 'vs/workbench/browser/parts/views/viewsViewlet';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
@@ -23,10 +23,10 @@ import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/la
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { IMenuService, MenuId } from 'vs/platform/actions/common/actions';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { ShowViewletAction } from 'vs/workbench/browser/viewlet';
|
||||
import { ShowViewletAction, Viewlet } from 'vs/workbench/browser/viewlet';
|
||||
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
|
||||
import { ViewletPane } from 'vs/workbench/browser/parts/views/paneViewlet';
|
||||
import { ViewPaneContainer, ViewPane } from 'vs/workbench/browser/parts/views/viewPaneContainer';
|
||||
|
||||
export const VIEWLET_ID = 'workbench.view.connections';
|
||||
|
||||
@@ -72,7 +72,23 @@ export class DataExplorerViewletViewsContribution implements IWorkbenchContribut
|
||||
}
|
||||
}
|
||||
|
||||
export class DataExplorerViewlet extends ViewContainerViewlet {
|
||||
export class DataExplorerViewlet extends Viewlet {
|
||||
constructor(
|
||||
@ITelemetryService telemetryService: ITelemetryService,
|
||||
@IStorageService protected storageService: IStorageService,
|
||||
@IInstantiationService protected instantiationService: IInstantiationService,
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IContextMenuService protected contextMenuService: IContextMenuService,
|
||||
@IExtensionService protected extensionService: IExtensionService,
|
||||
@IWorkspaceContextService protected contextService: IWorkspaceContextService,
|
||||
@IWorkbenchLayoutService protected layoutService: IWorkbenchLayoutService,
|
||||
@IConfigurationService protected configurationService: IConfigurationService
|
||||
) {
|
||||
super(VIEWLET_ID, instantiationService.createInstance(DataExplorerViewPaneContainer), telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService, layoutService, configurationService);
|
||||
}
|
||||
}
|
||||
|
||||
export class DataExplorerViewPaneContainer extends ViewPaneContainer {
|
||||
private root: HTMLElement;
|
||||
|
||||
private dataSourcesBox: HTMLElement;
|
||||
@@ -90,7 +106,7 @@ export class DataExplorerViewlet extends ViewContainerViewlet {
|
||||
@IMenuService private menuService: IMenuService,
|
||||
@IContextKeyService private contextKeyService: IContextKeyService
|
||||
) {
|
||||
super(VIEWLET_ID, `${VIEWLET_ID}.state`, true, configurationService, layoutService, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService);
|
||||
super(VIEWLET_ID, `${VIEWLET_ID}.state`, { showHeaderInTitleWhenSingleView: true }, instantiationService, configurationService, layoutService, contextMenuService, telemetryService, extensionService, themeService, storageService, contextService);
|
||||
}
|
||||
|
||||
create(parent: HTMLElement): void {
|
||||
@@ -134,13 +150,13 @@ export class DataExplorerViewlet extends ViewContainerViewlet {
|
||||
return actions;
|
||||
}
|
||||
|
||||
protected onDidAddViews(added: IAddedViewDescriptorRef[]): ViewletPane[] {
|
||||
protected onDidAddViews(added: IAddedViewDescriptorRef[]): ViewPane[] {
|
||||
const addedViews = super.onDidAddViews(added);
|
||||
return addedViews;
|
||||
}
|
||||
|
||||
protected createView(viewDescriptor: IViewDescriptor, options: IViewletViewOptions): ViewletPane {
|
||||
let viewletPanel = this.instantiationService.createInstance(viewDescriptor.ctorDescriptor.ctor, options) as ViewletPane;
|
||||
protected createView(viewDescriptor: IViewDescriptor, options: IViewletViewOptions): ViewPane {
|
||||
let viewletPanel = this.instantiationService.createInstance(viewDescriptor.ctorDescriptor.ctor, options) as ViewPane;
|
||||
this._register(viewletPanel);
|
||||
return viewletPanel;
|
||||
}
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import * as Platform from 'vs/platform/registry/common/platform';
|
||||
import { ViewletDescriptor, Extensions, Viewlet, ViewletRegistry } from 'vs/workbench/browser/viewlet';
|
||||
import * as Types from 'vs/base/common/types';
|
||||
|
||||
suite('Data Explorer Viewlet', () => {
|
||||
|
||||
class DataExplorerTestViewlet extends Viewlet {
|
||||
|
||||
constructor() {
|
||||
super('dataExplorer', null, null, null, null, null);
|
||||
}
|
||||
|
||||
public layout(dimension: any): void {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
}
|
||||
|
||||
test('ViewletDescriptor API', function () {
|
||||
let d = ViewletDescriptor.create(DataExplorerTestViewlet, 'id', 'name', 'class', 1);
|
||||
assert.strictEqual(d.id, 'id');
|
||||
assert.strictEqual(d.name, 'name');
|
||||
assert.strictEqual(d.cssClass, 'class');
|
||||
assert.strictEqual(d.order, 1);
|
||||
});
|
||||
|
||||
test('Editor Aware ViewletDescriptor API', function () {
|
||||
let d = ViewletDescriptor.create(DataExplorerTestViewlet, 'id', 'name', 'class', 5);
|
||||
assert.strictEqual(d.id, 'id');
|
||||
assert.strictEqual(d.name, 'name');
|
||||
|
||||
d = ViewletDescriptor.create(DataExplorerTestViewlet, 'id', 'name', 'class', 5);
|
||||
assert.strictEqual(d.id, 'id');
|
||||
assert.strictEqual(d.name, 'name');
|
||||
});
|
||||
|
||||
test('Data Explorer Viewlet extension point and registration', function () {
|
||||
assert(Types.isFunction(Platform.Registry.as<ViewletRegistry>(Extensions.Viewlets).registerViewlet));
|
||||
assert(Types.isFunction(Platform.Registry.as<ViewletRegistry>(Extensions.Viewlets).getViewlet));
|
||||
assert(Types.isFunction(Platform.Registry.as<ViewletRegistry>(Extensions.Viewlets).getViewlets));
|
||||
|
||||
let oldCount = Platform.Registry.as<ViewletRegistry>(Extensions.Viewlets).getViewlets().length;
|
||||
let d = ViewletDescriptor.create(DataExplorerTestViewlet, 'dataExplorer-test-id', 'name');
|
||||
Platform.Registry.as<ViewletRegistry>(Extensions.Viewlets).registerViewlet(d);
|
||||
let retrieved = Platform.Registry.as<ViewletRegistry>(Extensions.Viewlets).getViewlet('dataExplorer-test-id');
|
||||
assert(d === retrieved);
|
||||
let newCount = Platform.Registry.as<ViewletRegistry>(Extensions.Viewlets).getViewlets().length;
|
||||
assert.equal(oldCount + 1, newCount);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user