'user strict'; import * as vscode from 'vscode'; import { TreeDataProvider, TreeItem, EventEmitter, Event } from "vscode"; import { RhamtModelService } from "raas-core"; export class RhamtTreeDataProvider implements TreeDataProvider, vscode.Disposable { private _onDidChangeTreeData: EventEmitter = new EventEmitter(); readonly onDidChangeTreeData: Event = this._onDidChangeTreeData.event; constructor(private context: vscode.ExtensionContext, private modelService: RhamtModelService) { this.context.subscriptions.push(this); console.log('modelService config count: ' + this.modelService.getConfiguration); } public refresh(): any { this._onDidChangeTreeData.fire(); } public dispose(): void { } public getTreeItem(element: any): TreeItem { // if (element instanceof RhamtConfiguration) { // return new RhamtConfigurationNode(element); // } // return { // label: 'unknown' // }; return new TreeItem(''); } public async getChildren(element?: any): Promise { let result: any[]; if (!element) { result = await this.populateRoots(); } else { return new Promise(resolve => { resolve([]); }); } return result; } private async populateRoots(): Promise { return Promise.resolve([]); // let roots: any[] = []; // if (!this.modelService.initialized) { // roots = [new AzureNode(undefined, { // label: this._azureAccount.status === 'Initializing' ? localize('loadingNode', 'Loading...') : localize('signingIn', 'Waiting for Azure sign-in...'), // commandId: signInCommandId, // contextValue: 'azureCommandNode', // id: signInCommandId, // iconPath: { // light: path.join(__filename, '..', '..', '..', '..', 'resources', 'light', 'Loading.svg'), // dark: path.join(__filename, '..', '..', '..', '..', 'resources', 'dark', 'Loading.svg') // } // })]; // } // else { // } // return roots; // return new Promise(resolve => { // this.modelService.init().catch((e) => { // console.error(e); // vscode.window.showErrorMessage('rhamt model initlialization error: ' + e); // }).then(() => resolve(this.modelService.model.getConfigurations())); // }); } }