rework panel to not need platform (#5270)

This commit is contained in:
Anthony Dresser
2019-04-30 13:19:21 -07:00
committed by GitHub
parent f70369c2a6
commit 48682bacde
14 changed files with 107 additions and 97 deletions

View File

@@ -13,6 +13,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { DialogPane } from 'sql/platform/dialog/dialogPane';
import { Emitter, Event } from 'vs/base/common/event';
import { IWorkbenchLayoutService, Parts } from 'vs/workbench/services/layout/browser/layoutService';
import { IThemeService } from 'vs/platform/theme/common/themeService';
export type ModeViewSaveHandler = (handle: number) => Thenable<boolean>;
@@ -56,7 +57,8 @@ export class ModelViewInput extends EditorInput {
constructor(private _title: string, private _model: ModelViewInputModel,
private _options: azdata.ModelViewEditorOptions,
@IInstantiationService private _instantiationService: IInstantiationService,
@IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService
@IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService,
@IThemeService private readonly themeService: IThemeService
) {
super();
this._model.onDidChangeDirty(() => this._onDidChangeDirty.fire());
@@ -107,7 +109,7 @@ export class ModelViewInput extends EditorInput {
private createDialogPane(): void {
this._dialogPaneContainer = DOM.$('div.model-view-container');
this._dialogPane = new DialogPane(this.title, this.modelViewId, () => undefined, this._instantiationService, false);
this._dialogPane = new DialogPane(this.title, this.modelViewId, () => undefined, this._instantiationService, this.themeService, false);
this._dialogPane.createBody(this._dialogPaneContainer);
}

View File

@@ -9,7 +9,7 @@ import { Table } from 'sql/base/browser/ui/table/table';
import { TableDataView } from 'sql/base/browser/ui/table/tableDataView';
import { IProfilerService, IProfilerViewTemplate } from 'sql/workbench/services/profiler/common/interfaces';
import { Taskbar } from 'sql/base/browser/ui/taskbar/taskbar';
import { attachTableStyler } from 'sql/platform/theme/common/styler';
import { attachTableStyler, attachTabbedPanelStyler } from 'sql/platform/theme/common/styler';
import { IProfilerStateChangedEvent } from 'sql/workbench/parts/profiler/common/profilerState';
import { ProfilerTableEditor, ProfilerTableViewState } from 'sql/workbench/parts/profiler/browser/profilerTableEditor';
import * as Actions from 'sql/workbench/parts/profiler/browser/profilerActions';
@@ -335,6 +335,7 @@ export class ProfilerEditor extends BaseEditor {
let tabbedPanelContainer = document.createElement('div');
tabbedPanelContainer.className = 'profiler-tabbedPane';
this._tabbedPanel = new TabbedPanel(tabbedPanelContainer);
attachTabbedPanelStyler(this._tabbedPanel, this.themeService);
this._tabbedPanel.pushTab({
identifier: 'editor',
title: nls.localize('text', "Text"),

View File

@@ -131,7 +131,7 @@ export class QueryResultsEditor extends BaseEditor {
this.styleSheet.remove();
parent.appendChild(this.styleSheet);
if (!this.resultsView) {
this.resultsView = this._register(new QueryResultsView(parent, this._instantiationService, this._queryModelService));
this.resultsView = this._register(this._instantiationService.createInstance(QueryResultsView, parent));
}
}

View File

@@ -20,6 +20,8 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import * as DOM from 'vs/base/browser/dom';
import { Event } from 'vs/base/common/event';
import { IDisposable, dispose, Disposable } from 'vs/base/common/lifecycle';
import { attachTabbedPanelStyler } from 'sql/platform/theme/common/styler';
import { IThemeService } from 'vs/platform/theme/common/themeService';
class ResultsView extends Disposable implements IPanelView {
private panelViewlet: PanelViewlet;
@@ -182,7 +184,8 @@ export class QueryResultsView extends Disposable {
constructor(
container: HTMLElement,
@IInstantiationService private instantiationService: IInstantiationService,
@IQueryModelService private queryModelService: IQueryModelService
@IQueryModelService private queryModelService: IQueryModelService,
@IThemeService themeService: IThemeService
) {
super();
this.resultsTab = this._register(new ResultsTab(instantiationService));
@@ -191,6 +194,8 @@ export class QueryResultsView extends Disposable {
this.qpTab = this._register(new QueryPlanTab());
this.topOperationsTab = this._register(new TopOperationsTab(instantiationService));
attachTabbedPanelStyler(this._panelView, themeService);
this._panelView.pushTab(this.resultsTab);
this._register(this._panelView.onTabChange(e => {
if (this.input) {

View File

@@ -32,7 +32,7 @@ import { Table } from 'sql/base/browser/ui/table/table';
import { TableDataView } from 'sql/base/browser/ui/table/tableDataView';
import * as DialogHelper from 'sql/workbench/browser/modal/dialogHelper';
import { Modal } from 'sql/workbench/browser/modal/modal';
import { attachButtonStyler, attachModalDialogStyler, attachTableStyler, attachInputBoxStyler, attachSelectBoxStyler, attachEditableDropdownStyler, attachCheckboxStyler } from 'sql/platform/theme/common/styler';
import { attachButtonStyler, attachModalDialogStyler, attachTableStyler, attachInputBoxStyler, attachSelectBoxStyler, attachEditableDropdownStyler, attachCheckboxStyler, attachTabbedPanelStyler } from 'sql/platform/theme/common/styler';
import * as TelemetryKeys from 'sql/platform/telemetry/telemetryKeys';
import * as BackupConstants from 'sql/workbench/parts/backup/common/constants';
import { RestoreViewModel, RestoreOptionParam, SouceDatabaseNamesParam } from 'sql/workbench/parts/restore/browser/restoreViewModel';
@@ -326,6 +326,7 @@ export class RestoreDialog extends Modal {
const restorePanel = DOM.$('.restore-panel');
container.appendChild(restorePanel);
this._panel = new TabbedPanel(restorePanel);
attachTabbedPanelStyler(this._panel, this._themeService);
this._generalTabId = this._panel.pushTab({
identifier: 'general',
title: localize('generalTitle', 'General'),

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import 'vs/css!./media/connectionDialog';
import { Button } from 'sql/base/browser/ui/button/button';
import { attachModalDialogStyler, attachButtonStyler } from 'sql/platform/theme/common/styler';
import { attachModalDialogStyler, attachButtonStyler, attachTabbedPanelStyler } from 'sql/platform/theme/common/styler';
import { SelectBox } from 'sql/base/browser/ui/selectBox/selectBox';
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
import { Modal } from 'sql/workbench/browser/modal/modal';
@@ -153,6 +153,7 @@ export class ConnectionDialogWidget extends Modal {
DOM.hide(this._savedConnection);
this._panel = new TabbedPanel(this._body);
attachTabbedPanelStyler(this._panel, this._themeService);
this._recentConnectionTabId = this._panel.pushTab({
identifier: 'recent_connection',
title: localize('recentConnectionTitle', "Recent Connections"),