'use strict' ; import * as path from 'path' ; import { ProjectItemWizardPage } from './projectItemWizardPage' ; import { DevToolsExtensionContext } from '../../devToolsExtensionContext' ; import { ALTableWizardData } from './alTableWizardData' ; import { ALObjectWizardSettings } from './alObjectWizardSettings' ; import { ALTableSyntaxBuilder } from '../syntaxbuilders/alTableSyntaxBuilder' ; import { WizardTableFieldHelper } from './wizardTableFieldHelper' ; export class ALTableWizardPage extends ProjectItemWizardPage { private _tableWizardData : ALTableWizardData ; constructor ( toolsExtensionContext , settings , data ) { super ( toolsExtensionContext , "AL Table Wizard" , settings ) ; this . _tableWizardData = data ; } protected onDocumentLoaded ( ) { this . sendMessage ( { command : 'setData' , data : this . _tableWizardData } ) ; this . loadTypes ( ) ; } protected getHtmlContentPath ( ) { return path . join ( 'htmlresources' , 'altablewizard' , 'altablewizard.html' ) ; } protected getViewType ( ) { return "azALDevTools.ALTableWizard" ; } protected async finishWizard ( data ) { this . _tableWizardData . objectId = data . objectId ; this . _tableWizardData . objectName = data . objectName ; this . _tableWizardData . dataPerCompany = ! ! data . dataPerCompany ; this . _tableWizardData . fields = WizardTableFieldHelper . validateFields ( data . fields ) ; this . _tableWizardData . projectSettings = await this . getProjectSettings ( ) ; var builder = new ALTableSyntaxBuilder ( ) ; var source = builder . buildFromTableWizardData ( this . _settings . getDestDirectoryUri ( ) , this . _tableWizardData ) ; this . createObjectFile ( 'Table' , this . _tableWizardData . objectId , this . _tableWizardData . objectName , source ) ; return true ; } protected async loadTypes ( ) { let types = await WizardTableFieldHelper . getAllFieldTypes ( this . _toolsExtensionContext , this . _settings . getDestDirectoryUri ( ) ) ; if ( types . length > 0 ) { this . sendMessage ( { command : 'setTypes' , data : types } ) ; } } }