UNPKG

rhamt-vscode-extension

Version:

RHAMT VSCode extension

67 lines (55 loc) 2.75 kB
'use strict'; //import * as vscode from 'vscode'; // import { RhamtConfiguration } from "../rhamtService/main"; // import { ConfigurationServer } from './configurationServer'; // import * as EventBus from 'vertx3-eventbus-client'; // import { RhamtConfigurationNode } from '../explorer/rhamtNode'; // const scheme = "rhamt-configuration"; // const previewBaseUri = scheme + '://configuration/'; // const BUS = 'http://localhost:8081/eventbus/configuration'; export class ConfigurationEditorManager { //private _servers: Map<string, ConfigurationServer> = new Map<string, ConfigurationServer>(); // private _bus: EventBus.EventBus; //constructor(private _context: vscode.ExtensionContext) { //let documentProvider = new GraphViewDocumentContentProvider(this); //let registration = vscode.workspace.registerTextDocumentContentProvider(scheme, documentProvider); //this._context.subscriptions.push(registration); //this._bus = new EventBus(BUS); //this.initBus().then(() => this.registerCommands()).catch(e => console.log(e)); //} // private initBus(): Promise<void> { // return new Promise(resolve => { // this._bus.onopen = () => { // console.log('eventbus ready...'); // resolve(); // }; // }); // } // private registerCommands(): void { // this._context.subscriptions.push(vscode.commands.registerCommand('rhamt.openConfiguration', async (configuration: RhamtConfiguration) => { // this.openConfiguration(configuration); // })); // } // public terminate(): void { // this._bus.close(); // } // public async openConfiguration(configuration: RhamtConfiguration): Promise<void> { // try { // let id = await this.getOrCreateServer(configuration); // // Add server ID to the URL so that GraphViewDocumentContentProvider knows which port to use in the HTML // let serverUri = previewBaseUri + id; // await vscode.commands.executeCommand('vscode.previewHtml', vscode.Uri.parse(serverUri), vscode.ViewColumn.One, configuration.name); // } catch (error) { // vscode.window.showErrorMessage(error.message || error); // } // } // private async getOrCreateServer(configuration: RhamtConfiguration): Promise<string> { // if (this._servers.get(configuration.id)) { // return Promise.resolve(configuration.id); // } // let server = new ConfigurationServer(configuration, this._bus); // await server.start(); // this._servers.set(configuration.id, server); // return Promise.resolve(configuration.id); // } }