async function initializeWebview()

in src/classpath/classpathConfigurationView.ts [51:99]


async function initializeWebview(context: vscode.ExtensionContext): Promise<void> {
    if (!classpathConfigurationPanel) {
        sendError(new Error("classpathConfigurationPanel is not defined."));
        return;
    }

    context.subscriptions.push(classpathConfigurationPanel.onDidDispose(_e => classpathConfigurationPanel = undefined));

    classpathConfigurationPanel.iconPath = {
        light: vscode.Uri.file(path.join(context.extensionPath, "caption.light.svg")),
        dark: vscode.Uri.file(path.join(context.extensionPath, "caption.dark.svg"))
    };

    context.subscriptions.push(classpathConfigurationPanel.webview.onDidReceiveMessage((async (message) => {
        switch (message.command) {
            case "onWillListProjects":
                await listProjects();
                break;
            case "onWillLoadProjectClasspath":
                currentProjectRoot = vscode.Uri.parse(message.uri);
                await loadProjectClasspath(currentProjectRoot);
                break;
            case "onWillSelectOutputPath":
                await setOutputPath(currentProjectRoot);
                break;
            case "onWillAddSourcePath":
                await addSourcePath(currentProjectRoot);
                break;
            case "onWillRemoveSourcePath":
                removeSourcePath(currentProjectRoot, message.sourcePaths);
                break;
            case "onWillAddReferencedLibraries":
                await addReferencedLibraries(currentProjectRoot);
                break;
            case "onWillRemoveReferencedLibraries":
                removeReferencedLibrary(currentProjectRoot, message.path);
                break;
            case "onClickGotoProjectConfiguration":
                gotoProjectConfigurationFile(message.rootUri, message.projectType);
                break;
            default:
                break;
        }
    })));

    classpathConfigurationPanel.webview.html = getHtmlForWebview(context.asAbsolutePath("./out/assets/classpath/index.js"));

    await checkRequirement();
}