@@ -63,16 +63,16 @@ const folderValidator = (
63
63
64
64
class ContentNavigator implements SubscriptionProvider {
65
65
private contentDataProvider : ContentDataProvider ;
66
+ private contentModel : ContentModel ;
66
67
private sourceType : ContentNavigatorConfig [ "sourceType" ] ;
67
68
private treeIdentifier : ContentNavigatorConfig [ "treeIdentifier" ] ;
68
69
69
- get contentModel ( ) {
70
- return new ContentModel ( this . contentAdapterForConnectionType ( ) ) ;
71
- }
72
-
73
70
constructor ( context : ExtensionContext , config : ContentNavigatorConfig ) {
74
71
this . sourceType = config . sourceType ;
75
72
this . treeIdentifier = config . treeIdentifier ;
73
+ this . contentModel = new ContentModel (
74
+ this . contentAdapterForConnectionType ( ) ,
75
+ ) ;
76
76
this . contentDataProvider = new ContentDataProvider (
77
77
this . contentModel ,
78
78
context . extensionUri ,
@@ -290,6 +290,7 @@ class ContentNavigator implements SubscriptionProvider {
290
290
commands . registerCommand (
291
291
`${ SAS } .convertNotebookToFlow` ,
292
292
async ( resource : ContentItem | Uri ) => {
293
+ await this . contentModel . connect ( this . viyaEndpoint ( ) ) ;
293
294
const notebookToFlowConverter = new NotebookToFlowConverter (
294
295
resource ,
295
296
this . contentModel ,
@@ -400,7 +401,11 @@ class ContentNavigator implements SubscriptionProvider {
400
401
if ( event . affectsConfiguration ( "SAS.connectionProfiles" ) ) {
401
402
const endpoint = this . viyaEndpoint ( ) ;
402
403
this . collapseAllContent ( ) ;
403
- this . contentDataProvider . useModel ( this . contentModel ) ;
404
+ const contentModel = new ContentModel (
405
+ this . contentAdapterForConnectionType ( ) ,
406
+ ) ;
407
+ this . contentDataProvider . useModel ( contentModel ) ;
408
+ this . contentModel = contentModel ;
404
409
if ( endpoint ) {
405
410
await this . contentDataProvider . connect ( endpoint ) ;
406
411
} else {
@@ -412,10 +417,14 @@ class ContentNavigator implements SubscriptionProvider {
412
417
] ;
413
418
}
414
419
415
- private collapseAllContent ( ) {
416
- commands . executeCommand (
417
- `workbench.actions.treeView.${ this . treeIdentifier } .collapseAll` ,
420
+ private async collapseAllContent ( ) {
421
+ const collapeAllCmd = `workbench.actions.treeView.${ this . treeIdentifier } .collapseAll` ;
422
+ const commandExists = ( await commands . getCommands ( ) ) . find (
423
+ ( c ) => c === collapeAllCmd ,
418
424
) ;
425
+ if ( commandExists ) {
426
+ commands . executeCommand ( collapeAllCmd ) ;
427
+ }
419
428
}
420
429
421
430
private async uploadResource (
0 commit comments