import * as path from 'path' ; import { ALInterfaceWizardData } from "./alInterfaceWizardData" ; import { DevToolsExtensionContext } from "../../devToolsExtensionContext" ; import { ALObjectWizardSettings } from "./alObjectWizardSettings" ; import { ProjectItemWizardPage } from "./projectItemWizardPage" ; import { ALInterfaceSyntaxBuilder } from '../syntaxbuilders/alInterfaceSyntaxBuilder' ; import { ToolsSymbolInformationRequest } from '../../langserver/symbolsinformation/toolsSymbolInformationRequest' ; import { SymbolWithNameInformation } from '../../symbolsinformation/smbolWithNameInformation' ; export class ALInterfaceWizardPage extends ProjectItemWizardPage { protected _wizardData : ALInterfaceWizardData ; constructor ( toolsExtensionContext , settings , data ) { super ( toolsExtensionContext , "AL Interface Wizard" , settings ) ; this . _wizardData = data ; } protected getHtmlContentPath ( ) { return path . join ( 'htmlresources' , 'alinterfacewizard' , 'alinterfacewizard.html' ) ; } protected getViewType ( ) { return "azALDevTools.ALInterfaceWizard" ; } protected onDocumentLoaded ( ) { super . onDocumentLoaded ( ) ; this . loadCodeunits ( ) ; } protected async finishWizard ( data ) { this . _wizardData . objectName = data . objectName ; this . _wizardData . baseCodeunitName = data . baseCodeunitName ; let builder = new ALInterfaceSyntaxBuilder ( this . _toolsExtensionContext ) ; let source = await builder . buildFromInterfaceWizardDataAsync ( this . _settings . getDestDirectoryUri ( ) , this . _wizardData ) ; this . createObjectFile ( 'Interface' , '' , this . _wizardData . objectName , source ) ; return true ; } protected async loadCodeunits ( ) { let response = await this . _toolsExtensionContext . toolsLangServerClient . getCodeunitsList ( new ToolsSymbolInformationRequest ( this . _settings . getDestDirectoryPath ( ) , false ) ) ; if ( response ) this . _wizardData . codeunitList = SymbolWithNameInformation . toNamesList ( response . symbols ) ; if ( ( this . _wizardData . codeunitList ) && ( this . _wizardData . codeunitList . length > 0 ) ) this . sendMessage ( { command : "setCodeunits" , data : this . _wizardData . codeunitList } ) ; } }