@@ -9,11 +9,13 @@ import { ClassNode } from "./classesNode";
9
9
export class RootNode extends NodeBase {
10
10
public readonly contextValue : string ;
11
11
private readonly _category : string ;
12
+ private readonly isCsp : boolean ;
12
13
13
- public constructor ( label : string , fullName : string , contextValue : string , category : string , options : NodeOptions ) {
14
+ public constructor ( label : string , fullName : string , contextValue : string , category : string , options : NodeOptions , isCsp = false ) {
14
15
super ( label , fullName , options ) ;
15
16
this . contextValue = contextValue ;
16
17
this . _category = category ;
18
+ this . isCsp = isCsp ;
17
19
}
18
20
19
21
public get category ( ) : string {
@@ -29,7 +31,7 @@ export class RootNode extends NodeBase {
29
31
}
30
32
31
33
public async getChildren ( element ) : Promise < NodeBase [ ] > {
32
- const path = this instanceof PackageNode ? this . fullName + "/" : "" ;
34
+ const path = ( this instanceof PackageNode || this . isCsp ) ? this . fullName + "/" : "" ;
33
35
return this . getItems ( path , this . _category ) ;
34
36
}
35
37
@@ -50,6 +52,12 @@ export class RootNode extends NodeBase {
50
52
case "ALL" :
51
53
spec = "*.cls,*.mac,*.int,*.inc" ;
52
54
break ;
55
+ case "CSP" :
56
+ spec = "*" ;
57
+ break ;
58
+ case "OTHER" :
59
+ spec = "*" ;
60
+ break ;
53
61
default :
54
62
return ;
55
63
}
@@ -72,7 +80,12 @@ export class RootNode extends NodeBase {
72
80
} )
73
81
. then ( data =>
74
82
data . map ( el => {
75
- const fullName = ( this instanceof PackageNode ? this . fullName + "." : "" ) + el . Name ;
83
+ let fullName = el . Name ;
84
+ if ( this instanceof PackageNode ) {
85
+ fullName = this . fullName + "." + el . Name ;
86
+ } else if ( this . isCsp ) {
87
+ fullName = this . fullName + "/" + el . Name ;
88
+ }
76
89
return {
77
90
...el ,
78
91
fullName,
@@ -84,6 +97,15 @@ export class RootNode extends NodeBase {
84
97
public getItems ( path : string , category : string ) : Promise < NodeBase [ ] > {
85
98
return this . getList ( path , category , false ) . then ( data =>
86
99
data
100
+ . filter ( el => {
101
+ if ( category === "OTHER" ) {
102
+ return el . Type === "100" ;
103
+ } else if ( category === "CSP" ) {
104
+ return el . Type === "10" || el . Type === "5"
105
+ } else {
106
+ return true ;
107
+ }
108
+ } )
87
109
. map ( el => {
88
110
switch ( el . Type ) {
89
111
case "9" :
@@ -94,6 +116,12 @@ export class RootNode extends NodeBase {
94
116
case "1" :
95
117
case "2" :
96
118
return new RoutineNode ( el . Name , el . fullName , this . options ) ;
119
+ case "100" :
120
+ return new ClassNode ( el . Name , el . fullName , this . options ) ;
121
+ case "10" :
122
+ return new RootNode ( el . Name , el . fullName , this . contextValue , this . _category , this . options , true ) ;
123
+ case "5" :
124
+ return new ClassNode ( el . Name , el . fullName , this . options ) ;
97
125
default :
98
126
return null ;
99
127
}
0 commit comments