@@ -9,11 +9,20 @@ import { ClassNode } from "./classesNode";
99export class RootNode extends NodeBase {
1010 public readonly contextValue : string ;
1111 private readonly _category : string ;
12+ private readonly isCsp : boolean ;
1213
13- public constructor ( label : string , fullName : string , contextValue : string , category : string , options : NodeOptions ) {
14+ public constructor (
15+ label : string ,
16+ fullName : string ,
17+ contextValue : string ,
18+ category : string ,
19+ options : NodeOptions ,
20+ isCsp = false
21+ ) {
1422 super ( label , fullName , options ) ;
1523 this . contextValue = contextValue ;
1624 this . _category = category ;
25+ this . isCsp = isCsp ;
1726 }
1827
1928 public get category ( ) : string {
@@ -29,7 +38,7 @@ export class RootNode extends NodeBase {
2938 }
3039
3140 public async getChildren ( element ) : Promise < NodeBase [ ] > {
32- const path = this instanceof PackageNode ? this . fullName + "/" : "" ;
41+ const path = this instanceof PackageNode || this . isCsp ? this . fullName + "/" : "" ;
3342 return this . getItems ( path , this . _category ) ;
3443 }
3544
@@ -42,14 +51,20 @@ export class RootNode extends NodeBase {
4251 spec = "*.cls" ;
4352 break ;
4453 case "RTN" :
45- spec = "*.mac,*.int" ;
54+ spec = "*.mac,*.int,*.bas " ;
4655 break ;
4756 case "INC" :
4857 spec = "*.inc" ;
4958 break ;
5059 case "ALL" :
5160 spec = "*.cls,*.mac,*.int,*.inc" ;
5261 break ;
62+ case "CSP" :
63+ spec = "*" ;
64+ break ;
65+ case "OTH" :
66+ spec = "*" ;
67+ break ;
5368 default :
5469 return ;
5570 }
@@ -72,7 +87,12 @@ export class RootNode extends NodeBase {
7287 } )
7388 . then ( ( data ) =>
7489 data . map ( ( el ) => {
75- const fullName = ( this instanceof PackageNode ? this . fullName + "." : "" ) + el . Name ;
90+ let fullName = el . Name ;
91+ if ( this instanceof PackageNode ) {
92+ fullName = this . fullName + "." + el . Name ;
93+ } else if ( this . isCsp ) {
94+ fullName = this . fullName + "/" + el . Name ;
95+ }
7696 return {
7797 ...el ,
7898 fullName,
@@ -84,16 +104,31 @@ export class RootNode extends NodeBase {
84104 public getItems ( path : string , category : string ) : Promise < NodeBase [ ] > {
85105 return this . getList ( path , category , false ) . then ( ( data ) =>
86106 data
107+ . filter ( ( el ) => {
108+ if ( category === "OTH" ) {
109+ return el . Type === "100" ;
110+ } else if ( category === "CSP" ) {
111+ return el . Type === "10" || el . Type === "5" ;
112+ } else {
113+ return true ;
114+ }
115+ } )
87116 . map ( ( el ) => {
88117 switch ( el . Type ) {
89118 case "9" :
90119 return new PackageNode ( el . Name , el . fullName , category , this . options ) ;
91120 case "4" :
121+ case "5" :
122+ case "100" :
92123 return new ClassNode ( el . Name , el . fullName , this . options ) ;
93124 case "0" :
94125 case "1" :
95126 case "2" :
127+ case "3" :
128+ case "11" :
96129 return new RoutineNode ( el . Name , el . fullName , this . options ) ;
130+ case "10" :
131+ return new RootNode ( el . Name , el . fullName , "dataNode:CSPApplication" , this . _category , this . options , true ) ;
97132 default :
98133 return null ;
99134 }
0 commit comments