/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import Severity from '../../../../vs/base/common/severity'; import { createDecorator } from '../../../../vs/platform/instantiation/common/instantiation'; export interface IConfirmation { title?: string; message: string; detail?: string; primaryButton?: string; secondaryButton?: string; } export interface IConfirmationResult { /** * Will be true if the dialog was confirmed with the primary button * pressed. */ confirmed: boolean; /** * This will only be defined if the confirmation was created * with the checkbox option defined. */ checkboxChecked?: boolean; } export interface IShowResult { /** * Selected choice index. If the user refused to choose, * then a promise with index of `cancelId` option is returned. If there is no such * option then promise with index `0` is returned. */ choice: number; } export const IDialogService = createDecorator('dialogService'); export interface IDialogOptions { cancelId?: number; } /** * A service to bring up modal dialogs. * * Note: use the `INotificationService.prompt()` method for a non-modal way to ask * the user for input. */ export interface IDialogService { readonly _serviceBrand: undefined; /** * Ask the user for confirmation with a modal dialog. */ confirm(confirmation: IConfirmation): Promise; /** * Present a modal dialog to the user. * * @returns A promise with the selected choice index. If the user refused to choose, * then a promise with index of `cancelId` option is returned. If there is no such * option then promise with index `0` is returned. */ show( severity: Severity, message: string, buttons: string[], options?: IDialogOptions ): Promise; }