Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private async confirmOverwrite(uri: URI): Promise {
// Electron already handles the confirmation so do not prompt again.
if (this.isElectron()) {
return true;
}
// Prompt users for confirmation before overwriting.
const confirmed = await new ConfirmDialog({
title: 'Overwrite',
msg: `Do you really want to overwrite "${uri.toString()}"?`
}).open();
return !!confirmed;
}
return event => {
event.stopPropagation();
const dialog = new ConfirmDialog({
title: 'Delete Node?',
msg: 'Are you sure you want to delete the selected node?'
});
dialog.open().then(remove => {
if (remove && node.parent && node.parent && JsonFormsTree.Node.is(node.parent)) {
this.onDeleteEmitter.fire(node);
}
});
};
}
protected confirm(uris: URI[]): Promise {
return new ConfirmDialog({
title: `Delete File${uris.length === 1 ? '' : 's'}`,
msg: this.getConfirmMessage(uris)
}).open();
}
protected confirmAll(): Promise {
return new ConfirmDialog({
title: 'Discard All Changes',
msg: 'Do you really want to discard all changes?'
}).open();
}
bind(FileShouldOverwrite).toFunction(async function (file: FileStat, stat: FileStat): Promise {
const dialog = new ConfirmDialog({
title: `The file '${file.uri}' has been changed on the file system.`,
msg: 'Do you want to overwrite the changes made on the file system?',
ok: 'Yes',
cancel: 'No'
});
return !!await dialog.open();
});
protected confirmAll(): Promise {
return new ConfirmDialog({
title: 'Discard All Changes',
msg: 'Do you really want to discard all changes?'
}).open();
}
protected confirm(path: string): Promise {
const uri = new URI(path);
return new ConfirmDialog({
title: 'Discard changes',
msg: `Do you really want to discard changes in ${uri.displayName}?`
}).open();
}
protected async closeWorkspace(): Promise {
const dialog = new ConfirmDialog({
title: WorkspaceCommands.CLOSE.label!,
msg: 'Do you really want to close the workspace?'
});
if (await dialog.open()) {
await this.workspaceService.close();
}
}
protected confirmReplaceAll(resultNumber: number, fileNumber: number): Promise {
const go = fileNumber > 1;
return new ConfirmDialog({
title: 'Replace all',
msg: `Do you really want to replace ${resultNumber} match${resultNumber > 1 ? 'es' : ''} ${go ? 'across' : 'in'} `
+ `${fileNumber} file${go ? 's' : ''} with "${this._replaceTerm}"?`
}).open();
}