mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-17 17:22:42 -05:00
SQL Operations Studio Public Preview 1 (0.23) release source code
This commit is contained in:
57
src/sql/workbench/errorMessageDialog/errorMessageService.ts
Normal file
57
src/sql/workbench/errorMessageDialog/errorMessageService.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import { localize } from 'vs/nls';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
||||
import { IErrorMessageService } from 'sql/parts/connection/common/connectionManagement';
|
||||
import { ErrorMessageDialog } from 'sql/workbench/errorMessageDialog/errorMessageDialog';
|
||||
|
||||
export class ErrorMessageService implements IErrorMessageService {
|
||||
|
||||
_serviceBrand: any;
|
||||
|
||||
private _errorDialog: ErrorMessageDialog;
|
||||
|
||||
private handleOnOk(): void {
|
||||
}
|
||||
|
||||
constructor(
|
||||
@IInstantiationService private _instantiationService: IInstantiationService
|
||||
) { }
|
||||
|
||||
public showDialog(severity: Severity, headerTitle: string, message: string): void {
|
||||
this.doShowDialog(severity, headerTitle, message);
|
||||
}
|
||||
|
||||
private doShowDialog(severity: Severity, headerTitle: string, message: string): void {
|
||||
if (!this._errorDialog) {
|
||||
this._errorDialog = this._instantiationService.createInstance(ErrorMessageDialog);
|
||||
this._errorDialog.onOk(() => this.handleOnOk());
|
||||
this._errorDialog.render();
|
||||
}
|
||||
|
||||
let title = headerTitle ? headerTitle : this.getDefaultTitle(severity);
|
||||
return this._errorDialog.open(severity, title, message);
|
||||
}
|
||||
|
||||
private getDefaultTitle(severity: Severity) {
|
||||
let defaultTitle: string;
|
||||
switch (severity) {
|
||||
case Severity.Error:
|
||||
defaultTitle = localize('error', 'Error');
|
||||
break;
|
||||
case Severity.Warning:
|
||||
defaultTitle = localize('warning', 'Warning');
|
||||
break;
|
||||
case Severity.Info:
|
||||
defaultTitle = localize('info', 'Info');
|
||||
}
|
||||
return defaultTitle;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user