@@ -28,7 +28,8 @@ export class RootNode extends NodeBase {
2828 const path = this instanceof PackageNode ? this . fullName + "/" : "" ;
2929 return this . getItems ( path , this . _category ) ;
3030 }
31- public getItems ( path : string , category : string ) : Promise < NodeBase [ ] > {
31+
32+ public getList ( path : string , category : string , flat : boolean ) {
3233 const sql = "CALL %Library.RoutineMgr_StudioOpenDialog(?,?,?,?,?,?,?)" ;
3334 // const sql = "CALL %Library.RoutineMgr_StudioOpenDialog(?,,,,,,?)";
3435 let spec = "" ;
@@ -42,12 +43,14 @@ export class RootNode extends NodeBase {
4243 case "INC" :
4344 spec = "*.inc" ;
4445 break ;
46+ case "ALL" :
47+ spec = "*.cls,*.mac,*.int,*.inc" ;
48+ break ;
4549 default :
4650 return ;
4751 }
4852 const direction = "1" ;
4953 const orderBy = "1" ; // by Name
50- const flat = "0" ;
5154 const notStudio = "0" ;
5255 const generated = this . options . generated ? "1" : "0" ;
5356
@@ -58,29 +61,45 @@ export class RootNode extends NodeBase {
5861 const api = new AtelierAPI ( this . workspaceFolder ) ;
5962 api . setNamespace ( this . namespace ) ;
6063 return api
61- . actionQuery ( sql , [ spec , direction , orderBy , systemFiles , flat , notStudio , generated ] )
64+ . actionQuery ( sql , [ spec , direction , orderBy , systemFiles , flat ? "1" : "0" , notStudio , generated ] )
6265 . then ( data => {
6366 const content = data . result . content ;
6467 return content ;
6568 } )
6669 . then ( data =>
67- data
68- . map ( el => {
69- const fullName = ( this instanceof PackageNode ? this . fullName + "." : "" ) + el . Name ;
70- switch ( el . Type ) {
71- case "9" :
72- return new PackageNode ( el . Name , fullName , category , this . options ) ;
73- case "4" :
74- return new ClassNode ( el . Name , fullName , this . options ) ;
75- case "0" :
76- case "1" :
77- case "2" :
78- return new RoutineNode ( el . Name , fullName , this . options ) ;
79- default :
80- return null ;
81- }
82- } )
83- . filter ( el => el !== null )
70+ data . map ( el => {
71+ const fullName = ( this instanceof PackageNode ? this . fullName + "." : "" ) + el . Name ;
72+ return {
73+ ...el ,
74+ fullName,
75+ } ;
76+ } )
8477 ) ;
8578 }
79+
80+ public getItems ( path : string , category : string ) : Promise < NodeBase [ ] > {
81+ return this . getList ( path , category , false ) . then ( data =>
82+ data
83+ . map ( el => {
84+ switch ( el . Type ) {
85+ case "9" :
86+ return new PackageNode ( el . Name , el . fullName , category , this . options ) ;
87+ case "4" :
88+ return new ClassNode ( el . Name , el . fullName , this . options ) ;
89+ case "0" :
90+ case "1" :
91+ case "2" :
92+ return new RoutineNode ( el . Name , el . fullName , this . options ) ;
93+ default :
94+ return null ;
95+ }
96+ } )
97+ . filter ( el => el !== null )
98+ ) ;
99+ }
100+
101+ public getItems4Export ( ) : Promise < string [ ] > {
102+ const path = this instanceof PackageNode ? this . fullName + "/" : "" ;
103+ return this . getList ( path , "ALL" , true ) . then ( data => data . map ( el => el . Name ) ) ;
104+ }
86105}
0 commit comments