@@ -883,11 +883,14 @@ export class UserDataProfilesEditorModel extends EditorModel {
883
883
[ [ createAction ] , [ cancelAction , previewProfileAction ] ] ,
884
884
[ [ cancelAction ] , [ ] ] ,
885
885
) ) ;
886
- if ( this . newProfileElement ?. copyFrom && this . userDataProfilesService . profiles . some ( p => p . name === this . newProfileElement ?. name ) ) {
887
- createAction . label = localize ( 'replace' , "Replace" ) ;
888
- } else {
889
- createAction . label = localize ( 'create' , "Create" ) ;
890
- }
886
+ const updateCreateActionLabel = ( ) => {
887
+ if ( this . newProfileElement ?. copyFrom && this . userDataProfilesService . profiles . some ( p => p . name === this . newProfileElement ?. name ) ) {
888
+ createAction . label = localize ( 'replace' , "Replace" ) ;
889
+ } else {
890
+ createAction . label = localize ( 'create' , "Create" ) ;
891
+ }
892
+ } ;
893
+ updateCreateActionLabel ( ) ;
891
894
disposables . add ( this . newProfileElement . onDidChange ( e => {
892
895
if ( e . preview ) {
893
896
previewProfileAction . checked = ! ! this . newProfileElement ?. previewProfile ;
@@ -896,13 +899,13 @@ export class UserDataProfilesEditorModel extends EditorModel {
896
899
previewProfileAction . enabled = createAction . enabled = ! this . newProfileElement ?. disabled && ! this . newProfileElement ?. message ;
897
900
}
898
901
if ( e . name || e . copyFrom ) {
899
- if ( this . newProfileElement ?. copyFrom && this . userDataProfilesService . profiles . some ( p => p . name === this . newProfileElement ?. name ) ) {
900
- createAction . label = localize ( 'replace' , "Replace" ) ;
901
- } else {
902
- createAction . label = localize ( 'create' , "Create" ) ;
903
- }
902
+ updateCreateActionLabel ( ) ;
904
903
}
905
904
} ) ) ;
905
+ disposables . add ( this . userDataProfilesService . onDidChangeProfiles ( ( e ) => {
906
+ updateCreateActionLabel ( ) ;
907
+ this . newProfileElement ?. validate ( ) ;
908
+ } ) ) ;
906
909
this . _profiles . push ( [ this . newProfileElement , disposables ] ) ;
907
910
this . _onDidChange . fire ( this . newProfileElement ) ;
908
911
}
0 commit comments