@@ -299,81 +299,89 @@ export class StudioActions {
299
299
outputChannel . appendLine ( `${ query . slice ( 0 , query . indexOf ( "(" ) ) } (${ JSON . stringify ( parameters ) . slice ( 1 , - 1 ) } )` ) ;
300
300
}
301
301
302
- return new Promise ( ( resolve , reject ) => {
303
- this . api
304
- . actionQuery ( query , parameters )
305
- . then ( async ( data ) => {
306
- if ( action . save && action . id != "6" /* No save for import list */ ) {
307
- await this . processSaveFlag ( action . save ) ;
308
- }
309
- if ( ! afterUserAction ) {
310
- outputConsole ( data . console ) ;
311
- }
312
- if ( ! data . result . content . length ) {
313
- // Nothing to do. Most likely no source control class is enabled.
314
- this . projectEditAnswer = "1" ;
315
- return ;
316
- }
317
- const actionToProcess : UserAction = data . result . content . pop ( ) ;
318
-
319
- if ( actionToProcess . reload ) {
320
- // Avoid the reload triggering the edit listener here
321
- suppressEditListenerMap . set ( this . uri . toString ( ) , true ) ;
322
- await vscode . commands . executeCommand ( "workbench.action.files.revert" , this . uri ) ;
323
- }
302
+ return vscode . window . withProgress (
303
+ {
304
+ cancellable : false ,
305
+ location : vscode . ProgressLocation . Window ,
306
+ title : `Executing ${ afterUserAction ? "After" : "" } UserAction: ${ action . label } ` ,
307
+ } ,
308
+ ( ) =>
309
+ new Promise ( ( resolve , reject ) => {
310
+ this . api
311
+ . actionQuery ( query , parameters )
312
+ . then ( async ( data ) => {
313
+ if ( action . save && action . id != "6" /* No save for import list */ ) {
314
+ await this . processSaveFlag ( action . save ) ;
315
+ }
316
+ if ( ! afterUserAction ) {
317
+ outputConsole ( data . console ) ;
318
+ }
319
+ if ( ! data . result . content . length ) {
320
+ // Nothing to do. Most likely no source control class is enabled.
321
+ this . projectEditAnswer = "1" ;
322
+ return ;
323
+ }
324
+ const actionToProcess : UserAction = data . result . content . pop ( ) ;
324
325
325
- const attemptedEditLabel = getOtherStudioActionLabel ( OtherStudioAction . AttemptedEdit ) ;
326
- if ( afterUserAction && actionToProcess . errorText !== "" ) {
327
- if ( action . label === attemptedEditLabel ) {
328
- if ( this . name . toUpperCase ( ) . endsWith ( ".PRJ" ) ) {
329
- // Store the "answer" so the caller knows there was an error
330
- this . projectEditAnswer = "-1" ;
331
- } else if ( this . uri ) {
332
- // Only revert if we have a URI
326
+ if ( actionToProcess . reload ) {
327
+ // Avoid the reload triggering the edit listener here
333
328
suppressEditListenerMap . set ( this . uri . toString ( ) , true ) ;
334
329
await vscode . commands . executeCommand ( "workbench.action.files.revert" , this . uri ) ;
335
330
}
336
- }
337
- outputChannel . appendLine ( actionToProcess . errorText ) ;
338
- outputChannel . show ( true ) ;
339
- }
340
- if ( actionToProcess && ! afterUserAction ) {
341
- const answer = await this . processUserAction ( actionToProcess ) ;
342
- // call AfterUserAction only if there is a valid answer
343
- if ( action . label === attemptedEditLabel ) {
344
- if ( answer != "1" && this . uri ) {
345
- // Only revert if we have a URI
346
- suppressEditListenerMap . set ( this . uri . toString ( ) , true ) ;
347
- await vscode . commands . executeCommand ( "workbench.action.files.revert" , this . uri ) ;
331
+
332
+ const attemptedEditLabel = getOtherStudioActionLabel ( OtherStudioAction . AttemptedEdit ) ;
333
+ if ( afterUserAction && actionToProcess . errorText !== "" ) {
334
+ if ( action . label === attemptedEditLabel ) {
335
+ if ( this . name . toUpperCase ( ) . endsWith ( ".PRJ" ) ) {
336
+ // Store the "answer" so the caller knows there was an error
337
+ this . projectEditAnswer = "-1" ;
338
+ } else if ( this . uri ) {
339
+ // Only revert if we have a URI
340
+ suppressEditListenerMap . set ( this . uri . toString ( ) , true ) ;
341
+ await vscode . commands . executeCommand ( "workbench.action.files.revert" , this . uri ) ;
342
+ }
343
+ }
344
+ outputChannel . appendLine ( actionToProcess . errorText ) ;
345
+ outputChannel . show ( true ) ;
348
346
}
349
- if ( this . name . toUpperCase ( ) . endsWith ( ".PRJ" ) ) {
350
- // Store the answer. No answer means "allow the edit".
351
- this . projectEditAnswer = answer ?? "1" ;
347
+ if ( actionToProcess && ! afterUserAction ) {
348
+ const answer = await this . processUserAction ( actionToProcess ) ;
349
+ // call AfterUserAction only if there is a valid answer
350
+ if ( action . label === attemptedEditLabel ) {
351
+ if ( answer != "1" && this . uri ) {
352
+ // Only revert if we have a URI
353
+ suppressEditListenerMap . set ( this . uri . toString ( ) , true ) ;
354
+ await vscode . commands . executeCommand ( "workbench.action.files.revert" , this . uri ) ;
355
+ }
356
+ if ( this . name . toUpperCase ( ) . endsWith ( ".PRJ" ) ) {
357
+ // Store the answer. No answer means "allow the edit".
358
+ this . projectEditAnswer = answer ?? "1" ;
359
+ }
360
+ }
361
+ if ( answer ) {
362
+ answer . msg || answer . msg === ""
363
+ ? this . userAction ( action , true , answer . answer , answer . msg , type )
364
+ : this . userAction ( action , true , answer , "" , type ) ;
365
+ }
352
366
}
353
- }
354
- if ( answer ) {
355
- answer . msg || answer . msg === ""
356
- ? this . userAction ( action , true , answer . answer , answer . msg , type )
357
- : this . userAction ( action , true , answer , "" , type ) ;
358
- }
359
- }
367
+ } )
368
+ . then ( ( ) => resolve ( ) )
369
+ . catch ( ( err ) => {
370
+ outputChannel . appendLine (
371
+ `Executing Studio Action "${ action . label } " on ${ this . api . config . host } :${ this . api . config . port } ${
372
+ this . api . config . pathPrefix
373
+ } [${ this . api . config . ns } ] failed${
374
+ err . errorText && err . errorText !== "" ? " with the following error:" : "."
375
+ } `
376
+ ) ;
377
+ if ( err . errorText && err . errorText !== "" ) {
378
+ outputChannel . appendLine ( "\n" + err . errorText ) ;
379
+ }
380
+ outputChannel . show ( true ) ;
381
+ reject ( ) ;
382
+ } ) ;
360
383
} )
361
- . then ( ( ) => resolve ( ) )
362
- . catch ( ( err ) => {
363
- outputChannel . appendLine (
364
- `Executing Studio Action "${ action . label } " on ${ this . api . config . host } :${ this . api . config . port } ${
365
- this . api . config . pathPrefix
366
- } [${ this . api . config . ns } ] failed${
367
- err . errorText && err . errorText !== "" ? " with the following error:" : "."
368
- } `
369
- ) ;
370
- if ( err . errorText && err . errorText !== "" ) {
371
- outputChannel . appendLine ( "\n" + err . errorText ) ;
372
- }
373
- outputChannel . show ( true ) ;
374
- reject ( ) ;
375
- } ) ;
376
- } ) ;
384
+ ) ;
377
385
}
378
386
379
387
private prepareMenuItems ( menus , sourceControl : boolean ) : StudioAction [ ] {
0 commit comments