提交 16fac7f4 编写于 作者: B Benjamin Pasero

debt - confirmation service => dialog service

上级 bafcdc68
...@@ -39,7 +39,7 @@ import { OS } from 'vs/base/common/platform'; ...@@ -39,7 +39,7 @@ import { OS } from 'vs/base/common/platform';
import { IRange } from 'vs/editor/common/core/range'; import { IRange } from 'vs/editor/common/core/range';
import { ITextModel } from 'vs/editor/common/model'; import { ITextModel } from 'vs/editor/common/model';
import { INotificationService, INotification, INotificationHandle, NoOpNotification } from 'vs/platform/notification/common/notification'; import { INotificationService, INotification, INotificationHandle, NoOpNotification } from 'vs/platform/notification/common/notification';
import { IConfirmation, IConfirmationResult, IConfirmationService } from 'vs/platform/dialogs/common/dialogs'; import { IConfirmation, IConfirmationResult, IDialogService } from 'vs/platform/dialogs/common/dialogs';
import { IPosition, Position as Pos } from 'vs/editor/common/core/position'; import { IPosition, Position as Pos } from 'vs/editor/common/core/position';
export class SimpleEditor implements IEditor { export class SimpleEditor implements IEditor {
...@@ -236,7 +236,7 @@ export class SimpleProgressService implements IProgressService { ...@@ -236,7 +236,7 @@ export class SimpleProgressService implements IProgressService {
} }
} }
export class SimpleConfirmationService implements IConfirmationService { export class SimpleDialogService implements IDialogService {
public _serviceBrand: any; public _serviceBrand: any;
......
...@@ -33,7 +33,7 @@ import { CodeEditorServiceImpl } from 'vs/editor/browser/services/codeEditorServ ...@@ -33,7 +33,7 @@ import { CodeEditorServiceImpl } from 'vs/editor/browser/services/codeEditorServ
import { import {
SimpleConfigurationService, SimpleResourceConfigurationService, SimpleMenuService, SimpleConfigurationService, SimpleResourceConfigurationService, SimpleMenuService,
SimpleProgressService, StandaloneCommandService, StandaloneKeybindingService, SimpleNotificationService, SimpleProgressService, StandaloneCommandService, StandaloneKeybindingService, SimpleNotificationService,
StandaloneTelemetryService, SimpleWorkspaceContextService, SimpleConfirmationService StandaloneTelemetryService, SimpleWorkspaceContextService, SimpleDialogService
} from 'vs/editor/standalone/browser/simpleServices'; } from 'vs/editor/standalone/browser/simpleServices';
import { ContextKeyService } from 'vs/platform/contextkey/browser/contextKeyService'; import { ContextKeyService } from 'vs/platform/contextkey/browser/contextKeyService';
import { IMenuService } from 'vs/platform/actions/common/actions'; import { IMenuService } from 'vs/platform/actions/common/actions';
...@@ -41,7 +41,7 @@ import { IStandaloneThemeService } from 'vs/editor/standalone/common/standaloneT ...@@ -41,7 +41,7 @@ import { IStandaloneThemeService } from 'vs/editor/standalone/common/standaloneT
import { StandaloneThemeServiceImpl } from 'vs/editor/standalone/browser/standaloneThemeServiceImpl'; import { StandaloneThemeServiceImpl } from 'vs/editor/standalone/browser/standaloneThemeServiceImpl';
import { ILogService, NullLogService } from 'vs/platform/log/common/log'; import { ILogService, NullLogService } from 'vs/platform/log/common/log';
import { INotificationService } from 'vs/platform/notification/common/notification'; import { INotificationService } from 'vs/platform/notification/common/notification';
import { IConfirmationService } from 'vs/platform/dialogs/common/dialogs'; import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
export interface IEditorContextViewService extends IContextViewService { export interface IEditorContextViewService extends IContextViewService {
dispose(): void; dispose(): void;
...@@ -126,7 +126,7 @@ export module StaticServices { ...@@ -126,7 +126,7 @@ export module StaticServices {
export const telemetryService = define(ITelemetryService, () => new StandaloneTelemetryService()); export const telemetryService = define(ITelemetryService, () => new StandaloneTelemetryService());
export const confirmationService = define(IConfirmationService, () => new SimpleConfirmationService()); export const dialogService = define(IDialogService, () => new SimpleDialogService());
export const notificationService = define(INotificationService, () => new SimpleNotificationService()); export const notificationService = define(INotificationService, () => new SimpleNotificationService());
......
...@@ -25,7 +25,7 @@ export interface IConfirmationResult { ...@@ -25,7 +25,7 @@ export interface IConfirmationResult {
/** /**
* Will be true if the dialog was confirmed with the primary button * Will be true if the dialog was confirmed with the primary button
* pressed. * pressed.
*/ */
confirmed: boolean; confirmed: boolean;
...@@ -36,9 +36,9 @@ export interface IConfirmationResult { ...@@ -36,9 +36,9 @@ export interface IConfirmationResult {
checkboxChecked?: boolean; checkboxChecked?: boolean;
} }
export const IConfirmationService = createDecorator<IConfirmationService>('confirmationService'); export const IDialogService = createDecorator<IDialogService>('dialogService');
export interface IConfirmationService { export interface IDialogService {
_serviceBrand: any; _serviceBrand: any;
......
...@@ -44,7 +44,7 @@ export interface INotification { ...@@ -44,7 +44,7 @@ export interface INotification {
* close automatically when invoking a secondary action. * close automatically when invoking a secondary action.
* *
* **Note:** If your intent is to show a message with actions to the user, consider * **Note:** If your intent is to show a message with actions to the user, consider
* the `IChoiceService` and `IConfirmationService` instead which are optimized for * the `IChoiceService` or `IDialogService` instead which are optimized for
* this usecase and much easier to use! * this usecase and much easier to use!
*/ */
actions?: INotificationActions; actions?: INotificationActions;
...@@ -129,7 +129,7 @@ export interface INotificationService { ...@@ -129,7 +129,7 @@ export interface INotificationService {
* can be used to control the notification afterwards. * can be used to control the notification afterwards.
* *
* **Note:** If your intent is to show a message with actions to the user, consider * **Note:** If your intent is to show a message with actions to the user, consider
* the `IChoiceService` and `IConfirmationService` instead which are optimized for * the `IChoiceService` or `IDialogService` instead which are optimized for
* this usecase and much easier to use! * this usecase and much easier to use!
*/ */
notify(notification: INotification): INotificationHandle; notify(notification: INotification): INotificationHandle;
......
...@@ -94,7 +94,7 @@ import { WorkbenchIssueService } from 'vs/workbench/services/issue/electron-brow ...@@ -94,7 +94,7 @@ import { WorkbenchIssueService } from 'vs/workbench/services/issue/electron-brow
import { INotificationService } from 'vs/platform/notification/common/notification'; import { INotificationService } from 'vs/platform/notification/common/notification';
import { NotificationService } from 'vs/workbench/services/notification/common/notificationService'; import { NotificationService } from 'vs/workbench/services/notification/common/notificationService';
import { ChoiceChannel } from 'vs/platform/dialogs/common/choiceIpc'; import { ChoiceChannel } from 'vs/platform/dialogs/common/choiceIpc';
import { IChoiceService, IConfirmationService } from 'vs/platform/dialogs/common/dialogs'; import { IChoiceService, IDialogService } from 'vs/platform/dialogs/common/dialogs';
import { DialogService } from 'vs/workbench/services/dialogs/electron-browser/dialogs'; import { DialogService } from 'vs/workbench/services/dialogs/electron-browser/dialogs';
/** /**
...@@ -409,7 +409,7 @@ export class WorkbenchShell { ...@@ -409,7 +409,7 @@ export class WorkbenchShell {
const dialog = instantiationService.createInstance(DialogService); const dialog = instantiationService.createInstance(DialogService);
serviceCollection.set(IChoiceService, dialog); serviceCollection.set(IChoiceService, dialog);
serviceCollection.set(IConfirmationService, dialog); serviceCollection.set(IDialogService, dialog);
const lifecycleService = instantiationService.createInstance(LifecycleService); const lifecycleService = instantiationService.createInstance(LifecycleService);
this.toUnbind.push(lifecycleService.onShutdown(reason => this.dispose(reason))); this.toUnbind.push(lifecycleService.onShutdown(reason => this.dispose(reason)));
......
...@@ -17,7 +17,7 @@ import { Registry } from 'vs/platform/registry/common/platform'; ...@@ -17,7 +17,7 @@ import { Registry } from 'vs/platform/registry/common/platform';
import { IExtensionHostProfileService, ProfileSessionState, RuntimeExtensionsInput } from 'vs/workbench/parts/extensions/electron-browser/runtimeExtensionsEditor'; import { IExtensionHostProfileService, ProfileSessionState, RuntimeExtensionsInput } from 'vs/workbench/parts/extensions/electron-browser/runtimeExtensionsEditor';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IWindowsService } from 'vs/platform/windows/common/windows'; import { IWindowsService } from 'vs/platform/windows/common/windows';
import { IConfirmationService } from 'vs/platform/dialogs/common/dialogs'; import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
import { randomPort } from 'vs/base/node/ports'; import { randomPort } from 'vs/base/node/ports';
import product from 'vs/platform/node/product'; import product from 'vs/platform/node/product';
...@@ -43,7 +43,7 @@ export class ExtensionHostProfileService extends Disposable implements IExtensio ...@@ -43,7 +43,7 @@ export class ExtensionHostProfileService extends Disposable implements IExtensio
@IWorkbenchEditorService private readonly _editorService: IWorkbenchEditorService, @IWorkbenchEditorService private readonly _editorService: IWorkbenchEditorService,
@IInstantiationService private readonly _instantiationService: IInstantiationService, @IInstantiationService private readonly _instantiationService: IInstantiationService,
@IWindowsService private readonly _windowsService: IWindowsService, @IWindowsService private readonly _windowsService: IWindowsService,
@IConfirmationService private readonly _confirmationService: IConfirmationService @IDialogService private readonly _dialogService: IDialogService
) { ) {
super(); super();
this._profile = null; this._profile = null;
...@@ -75,7 +75,7 @@ export class ExtensionHostProfileService extends Disposable implements IExtensio ...@@ -75,7 +75,7 @@ export class ExtensionHostProfileService extends Disposable implements IExtensio
} }
if (!this._extensionService.canProfileExtensionHost()) { if (!this._extensionService.canProfileExtensionHost()) {
return this._confirmationService.confirm({ return this._dialogService.confirm({
type: 'info', type: 'info',
message: nls.localize('restart1', "Profile Extensions"), message: nls.localize('restart1', "Profile Extensions"),
detail: nls.localize('restart2', "In order to profile extensions a restart is required. Do you want to restart '{0}' now?", product.nameLong), detail: nls.localize('restart2', "In order to profile extensions a restart is required. Do you want to restart '{0}' now?", product.nameLong),
......
...@@ -51,7 +51,7 @@ import { IListService, ListWidget } from 'vs/platform/list/browser/listService'; ...@@ -51,7 +51,7 @@ import { IListService, ListWidget } from 'vs/platform/list/browser/listService';
import { RawContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { RawContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { distinctParents, basenameOrAuthority } from 'vs/base/common/resources'; import { distinctParents, basenameOrAuthority } from 'vs/base/common/resources';
import { Schemas } from 'vs/base/common/network'; import { Schemas } from 'vs/base/common/network';
import { IConfirmationService, IConfirmationResult, IConfirmation } from 'vs/platform/dialogs/common/dialogs'; import { IDialogService, IConfirmationResult, IConfirmation } from 'vs/platform/dialogs/common/dialogs';
import { getConfirmMessage } from 'vs/workbench/services/dialogs/electron-browser/dialogs'; import { getConfirmMessage } from 'vs/workbench/services/dialogs/electron-browser/dialogs';
import { INotificationService, Severity } from 'vs/platform/notification/common/notification'; import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
...@@ -566,7 +566,7 @@ class BaseDeleteFileAction extends BaseFileAction { ...@@ -566,7 +566,7 @@ class BaseDeleteFileAction extends BaseFileAction {
private useTrash: boolean, private useTrash: boolean,
@IFileService fileService: IFileService, @IFileService fileService: IFileService,
@INotificationService notificationService: INotificationService, @INotificationService notificationService: INotificationService,
@IConfirmationService private confirmationService: IConfirmationService, @IDialogService private dialogService: IDialogService,
@ITextFileService textFileService: ITextFileService, @ITextFileService textFileService: ITextFileService,
@IConfigurationService private configurationService: IConfigurationService @IConfigurationService private configurationService: IConfigurationService
) { ) {
...@@ -611,7 +611,7 @@ class BaseDeleteFileAction extends BaseFileAction { ...@@ -611,7 +611,7 @@ class BaseDeleteFileAction extends BaseFileAction {
message = nls.localize('dirtyMessageFileDelete', "You are deleting a file with unsaved changes. Do you want to continue?"); message = nls.localize('dirtyMessageFileDelete', "You are deleting a file with unsaved changes. Do you want to continue?");
} }
confirmDirtyPromise = this.confirmationService.confirm({ confirmDirtyPromise = this.dialogService.confirm({
message, message,
type: 'warning', type: 'warning',
detail: nls.localize('dirtyWarning', "Your changes will be lost if you don't save them."), detail: nls.localize('dirtyWarning', "Your changes will be lost if you don't save them."),
...@@ -644,7 +644,7 @@ class BaseDeleteFileAction extends BaseFileAction { ...@@ -644,7 +644,7 @@ class BaseDeleteFileAction extends BaseFileAction {
const message = distinctElements.length > 1 ? getConfirmMessage(nls.localize('confirmMoveTrashMessageMultiple', "Are you sure you want to delete the following {0} files?", distinctElements.length), distinctElements.map(e => e.resource)) const message = distinctElements.length > 1 ? getConfirmMessage(nls.localize('confirmMoveTrashMessageMultiple', "Are you sure you want to delete the following {0} files?", distinctElements.length), distinctElements.map(e => e.resource))
: distinctElements[0].isDirectory ? nls.localize('confirmMoveTrashMessageFolder', "Are you sure you want to delete '{0}' and its contents?", distinctElements[0].name) : distinctElements[0].isDirectory ? nls.localize('confirmMoveTrashMessageFolder', "Are you sure you want to delete '{0}' and its contents?", distinctElements[0].name)
: nls.localize('confirmMoveTrashMessageFile', "Are you sure you want to delete '{0}'?", distinctElements[0].name); : nls.localize('confirmMoveTrashMessageFile', "Are you sure you want to delete '{0}'?", distinctElements[0].name);
confirmDeletePromise = this.confirmationService.confirm({ confirmDeletePromise = this.dialogService.confirm({
message, message,
detail: isWindows ? nls.localize('undoBin', "You can restore from the Recycle Bin.") : nls.localize('undoTrash', "You can restore from the Trash."), detail: isWindows ? nls.localize('undoBin', "You can restore from the Recycle Bin.") : nls.localize('undoTrash', "You can restore from the Trash."),
primaryButton, primaryButton,
...@@ -660,7 +660,7 @@ class BaseDeleteFileAction extends BaseFileAction { ...@@ -660,7 +660,7 @@ class BaseDeleteFileAction extends BaseFileAction {
const message = distinctElements.length > 1 ? getConfirmMessage(nls.localize('confirmDeleteMessageMultiple', "Are you sure you want to permanently delete the following {0} files?", distinctElements.length), distinctElements.map(e => e.resource)) const message = distinctElements.length > 1 ? getConfirmMessage(nls.localize('confirmDeleteMessageMultiple', "Are you sure you want to permanently delete the following {0} files?", distinctElements.length), distinctElements.map(e => e.resource))
: distinctElements[0].isDirectory ? nls.localize('confirmDeleteMessageFolder', "Are you sure you want to permanently delete '{0}' and its contents?", distinctElements[0].name) : distinctElements[0].isDirectory ? nls.localize('confirmDeleteMessageFolder', "Are you sure you want to permanently delete '{0}' and its contents?", distinctElements[0].name)
: nls.localize('confirmDeleteMessageFile', "Are you sure you want to permanently delete '{0}'?", distinctElements[0].name); : nls.localize('confirmDeleteMessageFile', "Are you sure you want to permanently delete '{0}'?", distinctElements[0].name);
confirmDeletePromise = this.confirmationService.confirm({ confirmDeletePromise = this.dialogService.confirm({
message, message,
detail: nls.localize('irreversible', "This action is irreversible!"), detail: nls.localize('irreversible', "This action is irreversible!"),
primaryButton, primaryButton,
...@@ -703,7 +703,7 @@ class BaseDeleteFileAction extends BaseFileAction { ...@@ -703,7 +703,7 @@ class BaseDeleteFileAction extends BaseFileAction {
primaryButton = nls.localize({ key: 'retryButtonLabel', comment: ['&& denotes a mnemonic'] }, "&&Retry"); primaryButton = nls.localize({ key: 'retryButtonLabel', comment: ['&& denotes a mnemonic'] }, "&&Retry");
} }
return this.confirmationService.confirm({ return this.dialogService.confirm({
message: errorMessage, message: errorMessage,
detail: detailMessage, detail: detailMessage,
type: 'warning', type: 'warning',
...@@ -745,7 +745,7 @@ export class ImportFileAction extends BaseFileAction { ...@@ -745,7 +745,7 @@ export class ImportFileAction extends BaseFileAction {
clazz: string, clazz: string,
@IFileService fileService: IFileService, @IFileService fileService: IFileService,
@IWorkbenchEditorService private editorService: IWorkbenchEditorService, @IWorkbenchEditorService private editorService: IWorkbenchEditorService,
@IConfirmationService private confirmationService: IConfirmationService, @IDialogService private dialogService: IDialogService,
@INotificationService notificationService: INotificationService, @INotificationService notificationService: INotificationService,
@ITextFileService textFileService: ITextFileService @ITextFileService textFileService: ITextFileService
) { ) {
...@@ -798,7 +798,7 @@ export class ImportFileAction extends BaseFileAction { ...@@ -798,7 +798,7 @@ export class ImportFileAction extends BaseFileAction {
type: 'warning' type: 'warning'
}; };
overwritePromise = this.confirmationService.confirm(confirm); overwritePromise = this.dialogService.confirm(confirm);
} }
return overwritePromise.then(res => { return overwritePromise.then(res => {
......
...@@ -58,7 +58,7 @@ import { DataTransfers } from 'vs/base/browser/dnd'; ...@@ -58,7 +58,7 @@ import { DataTransfers } from 'vs/base/browser/dnd';
import { Schemas } from 'vs/base/common/network'; import { Schemas } from 'vs/base/common/network';
import { IWorkspaceFolderCreationData } from 'vs/platform/workspaces/common/workspaces'; import { IWorkspaceFolderCreationData } from 'vs/platform/workspaces/common/workspaces';
import { rtrim } from 'vs/base/common/strings'; import { rtrim } from 'vs/base/common/strings';
import { IConfirmationService, IConfirmationResult, IConfirmation } from 'vs/platform/dialogs/common/dialogs'; import { IDialogService, IConfirmationResult, IConfirmation } from 'vs/platform/dialogs/common/dialogs';
import { getConfirmMessage } from 'vs/workbench/services/dialogs/electron-browser/dialogs'; import { getConfirmMessage } from 'vs/workbench/services/dialogs/electron-browser/dialogs';
import { INotificationService } from 'vs/platform/notification/common/notification'; import { INotificationService } from 'vs/platform/notification/common/notification';
...@@ -714,7 +714,7 @@ export class FileDragAndDrop extends SimpleFileResourceDragAndDrop { ...@@ -714,7 +714,7 @@ export class FileDragAndDrop extends SimpleFileResourceDragAndDrop {
constructor( constructor(
@INotificationService private notificationService: INotificationService, @INotificationService private notificationService: INotificationService,
@IConfirmationService private confirmationService: IConfirmationService, @IDialogService private dialogService: IDialogService,
@IWorkspaceContextService private contextService: IWorkspaceContextService, @IWorkspaceContextService private contextService: IWorkspaceContextService,
@IFileService private fileService: IFileService, @IFileService private fileService: IFileService,
@IConfigurationService private configurationService: IConfigurationService, @IConfigurationService private configurationService: IConfigurationService,
...@@ -891,7 +891,7 @@ export class FileDragAndDrop extends SimpleFileResourceDragAndDrop { ...@@ -891,7 +891,7 @@ export class FileDragAndDrop extends SimpleFileResourceDragAndDrop {
// If we are in no-workspace context, ask for confirmation to create a workspace // If we are in no-workspace context, ask for confirmation to create a workspace
let confirmedPromise: TPromise<IConfirmationResult> = TPromise.wrap({ confirmed: true }); let confirmedPromise: TPromise<IConfirmationResult> = TPromise.wrap({ confirmed: true });
if (this.contextService.getWorkbenchState() !== WorkbenchState.WORKSPACE) { if (this.contextService.getWorkbenchState() !== WorkbenchState.WORKSPACE) {
confirmedPromise = this.confirmationService.confirm({ confirmedPromise = this.dialogService.confirm({
message: folders.length > 1 ? nls.localize('dropFolders', "Do you want to add the folders to the workspace?") : nls.localize('dropFolder', "Do you want to add the folder to the workspace?"), message: folders.length > 1 ? nls.localize('dropFolders', "Do you want to add the folders to the workspace?") : nls.localize('dropFolder', "Do you want to add the folder to the workspace?"),
type: 'question', type: 'question',
primaryButton: folders.length > 1 ? nls.localize('addFolders', "&&Add Folders") : nls.localize('addFolder', "&&Add Folder") primaryButton: folders.length > 1 ? nls.localize('addFolders', "&&Add Folders") : nls.localize('addFolder', "&&Add Folder")
...@@ -927,7 +927,7 @@ export class FileDragAndDrop extends SimpleFileResourceDragAndDrop { ...@@ -927,7 +927,7 @@ export class FileDragAndDrop extends SimpleFileResourceDragAndDrop {
// Handle confirm setting // Handle confirm setting
const confirmDragAndDrop = !isCopy && this.configurationService.getValue<boolean>(FileDragAndDrop.CONFIRM_DND_SETTING_KEY); const confirmDragAndDrop = !isCopy && this.configurationService.getValue<boolean>(FileDragAndDrop.CONFIRM_DND_SETTING_KEY);
if (confirmDragAndDrop) { if (confirmDragAndDrop) {
confirmPromise = this.confirmationService.confirm({ confirmPromise = this.dialogService.confirm({
message: sources.length > 1 ? getConfirmMessage(nls.localize('confirmMultiMove', "Are you sure you want to move the following {0} files?", sources.length), sources.map(s => s.resource)) message: sources.length > 1 ? getConfirmMessage(nls.localize('confirmMultiMove', "Are you sure you want to move the following {0} files?", sources.length), sources.map(s => s.resource))
: nls.localize('confirmMove', "Are you sure you want to move '{0}'?", sources[0].name), : nls.localize('confirmMove', "Are you sure you want to move '{0}'?", sources[0].name),
checkbox: { checkbox: {
...@@ -1053,7 +1053,7 @@ export class FileDragAndDrop extends SimpleFileResourceDragAndDrop { ...@@ -1053,7 +1053,7 @@ export class FileDragAndDrop extends SimpleFileResourceDragAndDrop {
}; };
// Move with overwrite if the user confirms // Move with overwrite if the user confirms
return this.confirmationService.confirm(confirm).then(res => { return this.dialogService.confirm(confirm).then(res => {
if (res.confirmed) { if (res.confirmed) {
const targetDirty = this.textFileService.getDirty().filter(d => resources.isEqualOrParent(d, targetResource, !isLinux /* ignorecase */)); const targetDirty = this.textFileService.getDirty().filter(d => resources.isEqualOrParent(d, targetResource, !isLinux /* ignorecase */));
......
...@@ -18,13 +18,13 @@ import { join, dirname } from 'path'; ...@@ -18,13 +18,13 @@ import { join, dirname } from 'path';
import { localize } from 'vs/nls'; import { localize } from 'vs/nls';
import { readdir, del, readFile } from 'vs/base/node/pfs'; import { readdir, del, readFile } from 'vs/base/node/pfs';
import { basename } from 'vs/base/common/paths'; import { basename } from 'vs/base/common/paths';
import { IConfirmationService } from 'vs/platform/dialogs/common/dialogs'; import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
class StartupProfiler implements IWorkbenchContribution { class StartupProfiler implements IWorkbenchContribution {
constructor( constructor(
@IWindowsService private readonly _windowsService: IWindowsService, @IWindowsService private readonly _windowsService: IWindowsService,
@IConfirmationService private readonly _confirmationService: IConfirmationService, @IDialogService private readonly _dialogService: IDialogService,
@IEnvironmentService private readonly _environmentService: IEnvironmentService, @IEnvironmentService private readonly _environmentService: IEnvironmentService,
@IInstantiationService private readonly _instantiationService: IInstantiationService, @IInstantiationService private readonly _instantiationService: IInstantiationService,
@ILifecycleService lifecycleService: ILifecycleService, @ILifecycleService lifecycleService: ILifecycleService,
...@@ -59,7 +59,7 @@ class StartupProfiler implements IWorkbenchContribution { ...@@ -59,7 +59,7 @@ class StartupProfiler implements IWorkbenchContribution {
}).then(files => { }).then(files => {
const profileFiles = files.reduce((prev, cur) => `${prev}${join(dir, cur)}\n`, '\n'); const profileFiles = files.reduce((prev, cur) => `${prev}${join(dir, cur)}\n`, '\n');
return this._confirmationService.confirm({ return this._dialogService.confirm({
type: 'info', type: 'info',
message: localize('prof.message', "Successfully created profiles."), message: localize('prof.message', "Successfully created profiles."),
detail: localize('prof.detail', "Please create an issue and manually attach the following files:\n{0}", profileFiles), detail: localize('prof.detail', "Please create an issue and manually attach the following files:\n{0}", profileFiles),
...@@ -73,7 +73,7 @@ class StartupProfiler implements IWorkbenchContribution { ...@@ -73,7 +73,7 @@ class StartupProfiler implements IWorkbenchContribution {
action.run(`:warning: Make sure to **attach** these files from your *home*-directory: :warning:\n${files.map(file => `-\`${file}\``).join('\n')}`) action.run(`:warning: Make sure to **attach** these files from your *home*-directory: :warning:\n${files.map(file => `-\`${file}\``).join('\n')}`)
]).then(() => { ]).then(() => {
// keep window stable until restart is selected // keep window stable until restart is selected
return this._confirmationService.confirm({ return this._dialogService.confirm({
type: 'info', type: 'info',
message: localize('prof.thanks', "Thanks for helping us."), message: localize('prof.thanks', "Thanks for helping us."),
detail: localize('prof.detail.restart', "A final restart is required to continue to use '{0}'. Again, thank you for your contribution.", this._environmentService.appNameLong), detail: localize('prof.detail.restart', "A final restart is required to continue to use '{0}'. Again, thank you for your contribution.", this._environmentService.appNameLong),
......
...@@ -19,7 +19,7 @@ import URI from 'vs/base/common/uri'; ...@@ -19,7 +19,7 @@ import URI from 'vs/base/common/uri';
import { isEqual } from 'vs/base/common/resources'; import { isEqual } from 'vs/base/common/resources';
import { isLinux } from 'vs/base/common/platform'; import { isLinux } from 'vs/base/common/platform';
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
import { IConfirmationService } from 'vs/platform/dialogs/common/dialogs'; import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
interface IConfiguration extends IWindowsConfiguration { interface IConfiguration extends IWindowsConfiguration {
update: { channel: string; }; update: { channel: string; };
...@@ -47,7 +47,7 @@ export class SettingsChangeRelauncher implements IWorkbenchContribution { ...@@ -47,7 +47,7 @@ export class SettingsChangeRelauncher implements IWorkbenchContribution {
@IWindowService private windowService: IWindowService, @IWindowService private windowService: IWindowService,
@IConfigurationService private configurationService: IConfigurationService, @IConfigurationService private configurationService: IConfigurationService,
@IEnvironmentService private envService: IEnvironmentService, @IEnvironmentService private envService: IEnvironmentService,
@IConfirmationService private confirmationService: IConfirmationService, @IDialogService private dialogService: IDialogService,
@IWorkspaceContextService private contextService: IWorkspaceContextService, @IWorkspaceContextService private contextService: IWorkspaceContextService,
@IExtensionService private extensionService: IExtensionService @IExtensionService private extensionService: IExtensionService
) { ) {
...@@ -146,7 +146,7 @@ export class SettingsChangeRelauncher implements IWorkbenchContribution { ...@@ -146,7 +146,7 @@ export class SettingsChangeRelauncher implements IWorkbenchContribution {
private doConfirm(message: string, detail: string, primaryButton: string, confirmed: () => void): void { private doConfirm(message: string, detail: string, primaryButton: string, confirmed: () => void): void {
this.windowService.isFocused().then(focused => { this.windowService.isFocused().then(focused => {
if (focused) { if (focused) {
return this.confirmationService.confirm({ return this.dialogService.confirm({
type: 'info', type: 'info',
message, message,
detail, detail,
......
...@@ -56,7 +56,7 @@ import { isDiffEditor, isCodeEditor, ICodeEditor } from 'vs/editor/browser/edito ...@@ -56,7 +56,7 @@ import { isDiffEditor, isCodeEditor, ICodeEditor } from 'vs/editor/browser/edito
import { TreeResourceNavigator, WorkbenchTree } from 'vs/platform/list/browser/listService'; import { TreeResourceNavigator, WorkbenchTree } from 'vs/platform/list/browser/listService';
import { IEditorOptions } from 'vs/editor/common/config/editorOptions'; import { IEditorOptions } from 'vs/editor/common/config/editorOptions';
import { SimpleFileResourceDragAndDrop } from 'vs/workbench/browser/dnd'; import { SimpleFileResourceDragAndDrop } from 'vs/workbench/browser/dnd';
import { IConfirmation, IConfirmationService } from 'vs/platform/dialogs/common/dialogs'; import { IConfirmation, IDialogService } from 'vs/platform/dialogs/common/dialogs';
import { INotificationService } from 'vs/platform/notification/common/notification'; import { INotificationService } from 'vs/platform/notification/common/notification';
import { IPanel } from 'vs/workbench/common/panel'; import { IPanel } from 'vs/workbench/common/panel';
import { IViewlet } from 'vs/workbench/common/viewlet'; import { IViewlet } from 'vs/workbench/common/viewlet';
...@@ -113,7 +113,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel { ...@@ -113,7 +113,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
@IEditorGroupService private editorGroupService: IEditorGroupService, @IEditorGroupService private editorGroupService: IEditorGroupService,
@IProgressService private progressService: IProgressService, @IProgressService private progressService: IProgressService,
@INotificationService private notificationService: INotificationService, @INotificationService private notificationService: INotificationService,
@IConfirmationService private confirmationService: IConfirmationService, @IDialogService private dialogService: IDialogService,
@IStorageService private storageService: IStorageService, @IStorageService private storageService: IStorageService,
@IContextViewService private contextViewService: IContextViewService, @IContextViewService private contextViewService: IContextViewService,
@IInstantiationService private instantiationService: IInstantiationService, @IInstantiationService private instantiationService: IInstantiationService,
...@@ -400,7 +400,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel { ...@@ -400,7 +400,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
type: 'question' type: 'question'
}; };
this.confirmationService.confirm(confirmation).then(res => { this.dialogService.confirm(confirmation).then(res => {
if (res.confirmed) { if (res.confirmed) {
this.searchWidget.setReplaceAllActionState(false); this.searchWidget.setReplaceAllActionState(false);
this.viewModel.searchResult.replaceAll(progressRunner).then(() => { this.viewModel.searchResult.replaceAll(progressRunner).then(() => {
......
...@@ -46,7 +46,7 @@ import { IProgressService2, IProgressOptions, ProgressLocation } from 'vs/platfo ...@@ -46,7 +46,7 @@ import { IProgressService2, IProgressOptions, ProgressLocation } from 'vs/platfo
import { IOpenerService } from 'vs/platform/opener/common/opener'; import { IOpenerService } from 'vs/platform/opener/common/opener';
import { IWindowService } from 'vs/platform/windows/common/windows'; import { IWindowService } from 'vs/platform/windows/common/windows';
import { INotificationService } from 'vs/platform/notification/common/notification'; import { INotificationService } from 'vs/platform/notification/common/notification';
import { IConfirmationService, IChoiceService, IConfirmationResult } from 'vs/platform/dialogs/common/dialogs'; import { IDialogService, IChoiceService, IConfirmationResult } from 'vs/platform/dialogs/common/dialogs';
import { IModelService } from 'vs/editor/common/services/modelService'; import { IModelService } from 'vs/editor/common/services/modelService';
...@@ -471,7 +471,7 @@ class TaskService implements ITaskService { ...@@ -471,7 +471,7 @@ class TaskService implements ITaskService {
@IProgressService2 private progressService: IProgressService2, @IProgressService2 private progressService: IProgressService2,
@IOpenerService private openerService: IOpenerService, @IOpenerService private openerService: IOpenerService,
@IWindowService private readonly _windowService: IWindowService, @IWindowService private readonly _windowService: IWindowService,
@IConfirmationService private confirmationService: IConfirmationService, @IDialogService private dialogService: IDialogService,
@INotificationService private notificationService: INotificationService, @INotificationService private notificationService: INotificationService,
@IChoiceService private choiceService: IChoiceService @IChoiceService private choiceService: IChoiceService
) { ) {
...@@ -1625,7 +1625,7 @@ class TaskService implements ITaskService { ...@@ -1625,7 +1625,7 @@ class TaskService implements ITaskService {
if (this._taskSystem.canAutoTerminate()) { if (this._taskSystem.canAutoTerminate()) {
terminatePromise = TPromise.wrap({ confirmed: true }); terminatePromise = TPromise.wrap({ confirmed: true });
} else { } else {
terminatePromise = this.confirmationService.confirm({ terminatePromise = this.dialogService.confirm({
message: nls.localize('TaskSystem.runningTask', 'There is a task running. Do you want to terminate it?'), message: nls.localize('TaskSystem.runningTask', 'There is a task running. Do you want to terminate it?'),
primaryButton: nls.localize({ key: 'TaskSystem.terminateTask', comment: ['&& denotes a mnemonic'] }, "&&Terminate Task"), primaryButton: nls.localize({ key: 'TaskSystem.terminateTask', comment: ['&& denotes a mnemonic'] }, "&&Terminate Task"),
type: 'question' type: 'question'
...@@ -1650,7 +1650,7 @@ class TaskService implements ITaskService { ...@@ -1650,7 +1650,7 @@ class TaskService implements ITaskService {
this.disposeTaskSystemListeners(); this.disposeTaskSystemListeners();
return false; // no veto return false; // no veto
} else if (code && code === TerminateResponseCode.ProcessNotFound) { } else if (code && code === TerminateResponseCode.ProcessNotFound) {
return this.confirmationService.confirm({ return this.dialogService.confirm({
message: nls.localize('TaskSystem.noProcess', 'The launched task doesn\'t exist anymore. If the task spawned background processes exiting VS Code might result in orphaned processes. To avoid this start the last background process with a wait flag.'), message: nls.localize('TaskSystem.noProcess', 'The launched task doesn\'t exist anymore. If the task spawned background processes exiting VS Code might result in orphaned processes. To avoid this start the last background process with a wait flag.'),
primaryButton: nls.localize({ key: 'TaskSystem.exitAnyways', comment: ['&& denotes a mnemonic'] }, "&&Exit Anyways"), primaryButton: nls.localize({ key: 'TaskSystem.exitAnyways', comment: ['&& denotes a mnemonic'] }, "&&Exit Anyways"),
type: 'info' type: 'info'
......
...@@ -22,7 +22,7 @@ import { IStorageService, StorageScope } from 'vs/platform/storage/common/storag ...@@ -22,7 +22,7 @@ import { IStorageService, StorageScope } from 'vs/platform/storage/common/storag
import { getTerminalDefaultShellWindows } from 'vs/workbench/parts/terminal/electron-browser/terminal'; import { getTerminalDefaultShellWindows } from 'vs/workbench/parts/terminal/electron-browser/terminal';
import { TerminalPanel } from 'vs/workbench/parts/terminal/electron-browser/terminalPanel'; import { TerminalPanel } from 'vs/workbench/parts/terminal/electron-browser/terminalPanel';
import { TerminalTab } from 'vs/workbench/parts/terminal/electron-browser/terminalTab'; import { TerminalTab } from 'vs/workbench/parts/terminal/electron-browser/terminalTab';
import { IChoiceService, IConfirmationService, Choice } from 'vs/platform/dialogs/common/dialogs'; import { IChoiceService, IDialogService, Choice } from 'vs/platform/dialogs/common/dialogs';
export class TerminalService extends AbstractTerminalService implements ITerminalService { export class TerminalService extends AbstractTerminalService implements ITerminalService {
private _configHelper: TerminalConfigHelper; private _configHelper: TerminalConfigHelper;
...@@ -43,7 +43,7 @@ export class TerminalService extends AbstractTerminalService implements ITermina ...@@ -43,7 +43,7 @@ export class TerminalService extends AbstractTerminalService implements ITermina
@IInstantiationService private readonly _instantiationService: IInstantiationService, @IInstantiationService private readonly _instantiationService: IInstantiationService,
@IQuickOpenService private readonly _quickOpenService: IQuickOpenService, @IQuickOpenService private readonly _quickOpenService: IQuickOpenService,
@IChoiceService private readonly _choiceService: IChoiceService, @IChoiceService private readonly _choiceService: IChoiceService,
@IConfirmationService private readonly _confirmationService: IConfirmationService @IDialogService private readonly _dialogService: IDialogService
) { ) {
super(contextKeyService, panelService, partService, lifecycleService, storageService); super(contextKeyService, panelService, partService, lifecycleService, storageService);
...@@ -225,7 +225,7 @@ export class TerminalService extends AbstractTerminalService implements ITermina ...@@ -225,7 +225,7 @@ export class TerminalService extends AbstractTerminalService implements ITermina
message = nls.localize('terminalService.terminalCloseConfirmationPlural', "There are {0} active terminal sessions, do you want to kill them?", this.terminalInstances.length); message = nls.localize('terminalService.terminalCloseConfirmationPlural', "There are {0} active terminal sessions, do you want to kill them?", this.terminalInstances.length);
} }
return this._confirmationService.confirm({ return this._dialogService.confirm({
message, message,
type: 'warning', type: 'warning',
}).then(res => !res.confirmed); }).then(res => !res.confirmed);
......
...@@ -13,7 +13,7 @@ import { isLinux, isMacintosh } from 'vs/base/common/platform'; ...@@ -13,7 +13,7 @@ import { isLinux, isMacintosh } from 'vs/base/common/platform';
import { Action } from 'vs/base/common/actions'; import { Action } from 'vs/base/common/actions';
import { IWindowService } from 'vs/platform/windows/common/windows'; import { IWindowService } from 'vs/platform/windows/common/windows';
import { mnemonicButtonLabel } from 'vs/base/common/labels'; import { mnemonicButtonLabel } from 'vs/base/common/labels';
import { IConfirmationService, IChoiceService, IConfirmation, IConfirmationResult, Choice } from 'vs/platform/dialogs/common/dialogs'; import { IDialogService, IChoiceService, IConfirmation, IConfirmationResult, Choice } from 'vs/platform/dialogs/common/dialogs';
import { INotificationService, INotificationHandle, INotificationActions } from 'vs/platform/notification/common/notification'; import { INotificationService, INotificationHandle, INotificationActions } from 'vs/platform/notification/common/notification';
import { once } from 'vs/base/common/event'; import { once } from 'vs/base/common/event';
import URI from 'vs/base/common/uri'; import URI from 'vs/base/common/uri';
...@@ -34,7 +34,7 @@ interface IMassagedMessageBoxOptions { ...@@ -34,7 +34,7 @@ interface IMassagedMessageBoxOptions {
buttonIndexMap: number[]; buttonIndexMap: number[];
} }
export class DialogService implements IChoiceService, IConfirmationService { export class DialogService implements IChoiceService, IDialogService {
public _serviceBrand: any; public _serviceBrand: any;
......
...@@ -62,7 +62,7 @@ import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; ...@@ -62,7 +62,7 @@ import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { MockContextKeyService } from 'vs/platform/keybinding/test/common/mockKeybindingService'; import { MockContextKeyService } from 'vs/platform/keybinding/test/common/mockKeybindingService';
import { ITextBufferFactory, DefaultEndOfLine, EndOfLinePreference } from 'vs/editor/common/model'; import { ITextBufferFactory, DefaultEndOfLine, EndOfLinePreference } from 'vs/editor/common/model';
import { Range } from 'vs/editor/common/core/range'; import { Range } from 'vs/editor/common/core/range';
import { IChoiceService, IConfirmation, IConfirmationResult, IConfirmationService } from 'vs/platform/dialogs/common/dialogs'; import { IChoiceService, IConfirmation, IConfirmationResult, IDialogService } from 'vs/platform/dialogs/common/dialogs';
import { INotificationService, INotificationHandle, INotification, NoOpNotification } from 'vs/platform/notification/common/notification'; import { INotificationService, INotificationHandle, INotification, NoOpNotification } from 'vs/platform/notification/common/notification';
export function createFileInput(instantiationService: IInstantiationService, resource: URI): FileEditorInput { export function createFileInput(instantiationService: IInstantiationService, resource: URI): FileEditorInput {
...@@ -333,7 +333,7 @@ export class TestNotificationService implements INotificationService { ...@@ -333,7 +333,7 @@ export class TestNotificationService implements INotificationService {
} }
} }
export class TestConfirmationService implements IConfirmationService { export class TestDialogService implements IDialogService {
public _serviceBrand: any; public _serviceBrand: any;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册