import * as vscode from 'vscode' ; import { DevToolsExtensionContext } from "../devToolsExtensionContext" ; import { NumberHelper } from '../tools/numberHelper' ; import { ToolsWorkspaceCommandResponse } from '../langserver/toolsWorkspaceCommandResponse' ; import { WorkspaceCommandSyntaxModifier } from './workspaceCommandSyntaxModifier' ; export class AppAreasModifier extends WorkspaceCommandSyntaxModifier { protected _appArea : string | undefined ; constructor ( context ) { super ( context , "Add App Areas" , "addAppAreas" ) ; this . _appArea = undefined ; } protected getParameters ( uri ) { let parameters = super . getParameters ( uri ) ; parameters . appArea = this . _appArea ; return parameters ; } protected async confirmRunForWorkspace ( ) { let confirmation = await vscode . window . showInformationMessage ( 'Do you want to add missing application areas to all files in the current project folder?' , 'Yes' , 'No' ) ; return ( confirmation === 'Yes' ) ; } protected getSuccessWorkspaceMessage ( response ) { return NumberHelper . zeroIfNotDef ( response . parameters . noOfChanges ) . toString ( ) + ' application area(s) added to ' + NumberHelper . zeroIfNotDef ( response . parameters . noOfChangedFiles ) . toString ( ) + ' file(s).' ; } protected getSuccessDocumentMessage ( response ) { return response . parameters . noOfChanges . toString ( ) + ' application area(s) added.' ; } protected loadDefaultParameters ( uri ) { this . _appArea = vscode . workspace . getConfiguration ( 'alOutline' , uri ) . get < string > ( 'defaultAppArea' ) ; return ( ( ! ! this . _appArea ) && ( this . _appArea != '' ) ) ; } async askForParameters ( uri ) { let appAreasList = [ 'Basic' , 'FixedAsset' , 'All' , 'Custom' ] ; let appAreaName = await vscode . window . showQuickPick ( appAreasList , { canPickMany : false , placeHolder : 'Select Application Area' } ) ; if ( ! appAreaName ) return false ; if ( appAreaName === 'Custom' ) { appAreaName = await vscode . window . showInputBox ( { placeHolder : "Enter your custom Application Area" } ) ; if ( ! appAreaName ) return false ; } this . _appArea = appAreaName ; return true ; } }