in src/handler/GenerateProjectHandler.ts [41:69]
public async runSteps(operationId?: string): Promise<void> {
let step: IStep | undefined = SpecifyServiceUrlStep.getInstance();
SpecifyArtifactIdStep.getInstance().resetDefaultInput();
SpecifyGroupIdStep.getInstance().resetDefaultInput();
while (step !== undefined) {
step = await step.execute(operationId, this.metadata);
}
// Step: Choose target folder
this.outputUri = await instrumentOperationStep(operationId, "TargetFolder", specifyTargetFolder)(this.metadata);
if (this.outputUri === undefined) { throw new OperationCanceledError("Target folder not specified."); }
// Step: Download & Unzip
await instrumentOperationStep(operationId, "DownloadUnzip", downloadAndUnzip)(this.downloadUrl, this.outputUri.fsPath);
// Open project either is the same workspace or new workspace
const hasOpenFolder = vscode.workspace.workspaceFolders !== undefined || vscode.workspace.rootPath !== undefined;
const projectLocation = this.outputUri.fsPath;
const choice = await specifyOpenMethod(hasOpenFolder, this.outputUri.fsPath);
if (choice === OPEN_IN_NEW_WORKSPACE) {
vscode.commands.executeCommand("vscode.openFolder", vscode.Uri.file(path.join(projectLocation, this.metadata.artifactId)), hasOpenFolder);
} else if (choice === OPEN_IN_CURRENT_WORKSPACE) {
if (!vscode.workspace.workspaceFolders.find((workspaceFolder) => workspaceFolder.uri && this.outputUri.fsPath.startsWith(workspaceFolder.uri.fsPath))) {
vscode.workspace.updateWorkspaceFolders(vscode.workspace.workspaceFolders.length, null, { uri: vscode.Uri.file(path.join(projectLocation, this.metadata.artifactId)) });
}
}
}