import { Window } from "../window" ; import { workspace_window } from "../../global" ; import { BrowserWindow , ipcMain } from "electron" ; import { throws } from "assert" ; export class AssignClassWindow extends Window { private selected : boolean ; private readonly environment : string ; private readonly certname : string ; private readonly hierarchy : number ; private readonly nodeHierarchy : any ; private readonly includeName : string ; constructor ( environment , certname , hierarchy , nodeHierarchy , includeName ) { super ( ) ; this . selected = false ; this . environment = environment ; this . certname = certname ; this . hierarchy = hierarchy ; this . nodeHierarchy = nodeHierarchy ; this . includeName = includeName ; } public show ( ) { return new Promise < string > ( ( resolve , reject ) => { this . openWindow ( 600 , 400 , "assign_class.html" , null , { resizable : false , modal : true , autoHideMenuBar : true , parent : workspace_window . browserWindow } , ( browserWindow ) => { browserWindow . webContents . send ( 'init' , this . environment , this . certname , this . hierarchy , this . nodeHierarchy , this . includeName ) ; } ) ; ipcMain . on ( "class-selected" , ( event , className ) => { if ( className != null ) { this . selected = true ; resolve ( className ) ; } this . close ( ) ; } ) ; this . onClosed = ( ) => { ipcMain . removeAllListeners ( "class-selected" ) ; if ( ! this . selected ) { resolve ( null ) ; } } ; } ) ; } }