@@ -1940,16 +1940,12 @@ public void DisplayOrEditAasEntitySubmodelOrRef(
1940
1940
ticketMenu : new AasxMenu ( )
1941
1941
. AddAction ( "upgrade-qualifiers" , "Upgrade qualifiers" ,
1942
1942
"Upgrades particular qualifiers from V2.0 to V3.0 for selected element." )
1943
- #if __moved_to_menu
1944
- . AddAction ( "SMT-qualifiers-convert" , "Convert SMT qualifiers" ,
1945
- "Converts particular SMT qualifiers to SMT extension for selected element." )
1946
- . AddAction ( "SMT-set-organize" , "Set SMT organize" ,
1947
- "Take over Submodel's element relationships to associated concepts." )
1948
- #endif
1949
1943
. AddAction ( "remove-qualifiers" , "Remove qualifiers" ,
1950
1944
"Removes all qualifiers for selected element." )
1951
1945
. AddAction ( "remove-extensions" , "Remove extensions" ,
1952
- "Removes all extensions for selected element." ) ,
1946
+ "Removes all extensions for selected element." )
1947
+ . AddAction ( "fix-references" , "Fix References" ,
1948
+ "Fix, if References first key to Identifiables use idShort instead of id." ) ,
1953
1949
ticketAction : ( buttonNdx , ticket ) =>
1954
1950
{
1955
1951
if ( buttonNdx == 0 )
@@ -2151,6 +2147,42 @@ public void DisplayOrEditAasEntitySubmodelOrRef(
2151
2147
return new AnyUiLambdaActionRedrawAllElements ( nextFocus : smref , isExpanded : true ) ;
2152
2148
}
2153
2149
2150
+ if ( buttonNdx == 3 )
2151
+ {
2152
+ // confirm
2153
+ if ( ticket ? . ScriptMode != true
2154
+ && AnyUiMessageBoxResult . Yes != this . context . MessageBoxFlyoutShow (
2155
+ "This operation will affect all References within " +
2156
+ "the Submodel and all of its SubmodelElements. Do you want to proceed?" ,
2157
+ "Fix References" ,
2158
+ AnyUiMessageBoxButton . YesNo , AnyUiMessageBoxImage . Warning ) )
2159
+ return new AnyUiLambdaActionNone ( ) ;
2160
+
2161
+ // action
2162
+ try
2163
+ {
2164
+ ExtendIReferable . FixReferences ( submodel , env ? . AllSubmodels ( ) ) ;
2165
+ submodel . RecurseOnSubmodelElements ( null , ( o , parents , sme ) =>
2166
+ {
2167
+ // upgrade
2168
+ ExtendIReferable . FixReferences ( sme , env ? . AllSubmodels ( ) ) ;
2169
+
2170
+ // recurse
2171
+ return true ;
2172
+ } ) ;
2173
+
2174
+ }
2175
+ catch ( Exception ex )
2176
+ {
2177
+ Log . Singleton . Error (
2178
+ ex , $ "While fixing References.") ;
2179
+ }
2180
+
2181
+ // emit event for Submodel and children
2182
+ this . AddDiaryEntry ( submodel , new DiaryEntryStructChange ( ) , allChildrenAffected : true ) ;
2183
+
2184
+ return new AnyUiLambdaActionRedrawAllElements ( nextFocus : smref , isExpanded : true ) ;
2185
+ }
2154
2186
return new AnyUiLambdaActionNone ( ) ;
2155
2187
} ) ;
2156
2188
0 commit comments