dialogs - set type properly

This commit is contained in:
Benjamin Pasero 2017-06-08 09:45:21 +02:00
parent efa84ba725
commit 7ceab4ec6e
6 changed files with 19 additions and 11 deletions

View file

@ -149,7 +149,8 @@ export class ElectronWindow extends Themable {
if (draggedExternalResources.length > 20) {
doOpen = this.messageService.confirm({
message: nls.localize('confirmOpen', "Are you sure you want to open {0} folders?", draggedExternalResources.length),
primaryButton: nls.localize({ key: 'confirmOpenButton', comment: ['&& denotes a mnemonic'] }, "&&Open")
primaryButton: nls.localize({ key: 'confirmOpenButton', comment: ['&& denotes a mnemonic'] }, "&&Open"),
type: 'question'
});
}

View file

@ -865,7 +865,7 @@ export class ReloadAction extends Action {
}
run(): TPromise<any> {
if (this.messageService.confirm({ message: this.reloadMessaage, primaryButton: localize('reload', "&&Reload Window") })) {
if (this.messageService.confirm({ message: this.reloadMessaage, type: 'question', primaryButton: localize('reload', "&&Reload Window") })) {
return this.windowService.reloadWindow();
}
return TPromise.wrap(null);

View file

@ -698,13 +698,15 @@ export class BaseDeleteFileAction extends BaseFileAction {
confirm = {
message: this.element.isDirectory ? nls.localize('confirmMoveTrashMessageFolder', "Are you sure you want to delete '{0}' and its contents?", this.element.name) : nls.localize('confirmMoveTrashMessageFile', "Are you sure you want to delete '{0}'?", this.element.name),
detail: isWindows ? nls.localize('undoBin', "You can restore from the recycle bin.") : nls.localize('undoTrash', "You can restore from the trash."),
primaryButton
primaryButton,
type: 'question'
};
} else {
confirm = {
message: this.element.isDirectory ? nls.localize('confirmDeleteMessageFolder', "Are you sure you want to permanently delete '{0}' and its contents?", this.element.name) : nls.localize('confirmDeleteMessageFile', "Are you sure you want to permanently delete '{0}'?", this.element.name),
detail: nls.localize('irreversible', "This action is irreversible!"),
primaryButton
primaryButton,
type: 'warning'
};
}
@ -823,7 +825,8 @@ export class ImportFileAction extends BaseFileAction {
const confirm: IConfirmation = {
message: nls.localize('confirmOverwrite', "A file or folder with the same name already exists in the destination folder. Do you want to replace it?"),
detail: nls.localize('irreversible', "This action is irreversible!"),
primaryButton: nls.localize({ key: 'replaceButtonLabel', comment: ['&& denotes a mnemonic'] }, "&&Replace")
primaryButton: nls.localize({ key: 'replaceButtonLabel', comment: ['&& denotes a mnemonic'] }, "&&Replace"),
type: 'warning'
};
overwrite = this.messageService.confirm(confirm);

View file

@ -804,7 +804,8 @@ export class FileDragAndDrop implements IDragAndDrop {
const confirm: IConfirmation = {
message: nls.localize('confirmOverwriteMessage', "'{0}' already exists in the destination folder. Do you want to replace it?", source.name),
detail: nls.localize('irreversible', "This action is irreversible!"),
primaryButton: nls.localize({ key: 'replaceButtonLabel', comment: ['&& denotes a mnemonic'] }, "&&Replace")
primaryButton: nls.localize({ key: 'replaceButtonLabel', comment: ['&& denotes a mnemonic'] }, "&&Replace"),
type: 'warning'
};
// Move with overwrite if the user confirms

View file

@ -38,7 +38,7 @@ import { IStorageService, StorageScope } from 'vs/platform/storage/common/storag
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IMessageService } from 'vs/platform/message/common/message';
import { IMessageService, IConfirmation } from 'vs/platform/message/common/message';
import { IProgressService } from 'vs/platform/progress/common/progress';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
@ -368,10 +368,11 @@ export class SearchViewlet extends Viewlet {
let replaceValue = this.searchWidget.getReplaceValue() || '';
let afterReplaceAllMessage = this.buildAfterReplaceAllMessage(occurrences, fileCount, replaceValue);
let confirmation = {
let confirmation: IConfirmation = {
title: nls.localize('replaceAll.confirmation.title', "Replace All"),
message: this.buildReplaceAllConfirmationMessage(occurrences, fileCount, replaceValue),
primaryButton: nls.localize('replaceAll.confirm.button', "Replace")
primaryButton: nls.localize('replaceAll.confirm.button', "Replace"),
type: 'question'
};
if (this.messageService.confirm(confirmation)) {

View file

@ -1251,7 +1251,8 @@ class TaskService extends EventEmitter implements ITaskService {
if (this._taskSystem && this._taskSystem.isActiveSync()) {
if (this._taskSystem.canAutoTerminate() || this.messageService.confirm({
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'
})) {
return this._taskSystem.terminateAll().then((response) => {
if (response.success) {
@ -1262,7 +1263,8 @@ class TaskService extends EventEmitter implements ITaskService {
} else if (response.code && response.code === TerminateResponseCode.ProcessNotFound) {
return !this.messageService.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.'),
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'
});
}
return true; // veto