@@ -1841,7 +1841,7 @@ public void DispSmeListAddNewHelper<T>(
1841
1841
Aas . Environment env ,
1842
1842
AnyUiStackPanel stack , ModifyRepo repo , string key ,
1843
1843
List < T > smeList ,
1844
- Action < List < T > > setValueLambda = null ,
1844
+ Action < List < T > > setOutput = null ,
1845
1845
AasxMenu superMenu = null ,
1846
1846
Aas . IReference basedOnSemanticId = null ) where T : class , ISubmodelElement
1847
1847
{
@@ -1856,7 +1856,8 @@ public void DispSmeListAddNewHelper<T>(
1856
1856
this . AddHintBubble ( stack , hintMode , new [ ] {
1857
1857
new HintCheck (
1858
1858
( ) => { return smeList == null || smeList . Count < 1 ; } ,
1859
- "This element currently has no SubmodelElements, yet. " +
1859
+ "This element currently has no SubmodelElements, yet. " +
1860
+ ( smeList == null ? "List is null! " : "List is empty! " ) +
1860
1861
"These are the actual carriers of information. " +
1861
1862
"You could create them by clicking the 'Add ..' buttons below. " +
1862
1863
"Subsequently, when having a SubmodelElement established, " +
@@ -1866,24 +1867,29 @@ public void DispSmeListAddNewHelper<T>(
1866
1867
1867
1868
// menu
1868
1869
var isDataElem = typeof ( IDataElement ) . IsAssignableFrom ( typeof ( T ) ) ;
1870
+
1871
+ // 0 and 1
1869
1872
var menu = new AasxMenu ( )
1870
1873
. AddAction ( "add-prop" , "Add Property" ,
1871
1874
"Adds a new Property to the containing collection." )
1872
1875
. AddAction ( "add-mlp" , "Add MultiLang.Prop." ,
1873
1876
"Adds a new MultiLanguageProperty to the containing collection." ) ;
1874
1877
1878
+ // 2
1875
1879
if ( ! isDataElem )
1876
1880
menu . AddAction ( "add-smc" , "Add Collection" ,
1877
1881
"Adds a new SubmodelElementCollection to the containing collection." ) ;
1878
1882
else
1879
1883
menu . AddAction ( "add-range" , "Add Range" ,
1880
1884
"Adds a new Range to the containing collection." ) ;
1881
1885
1886
+ // 3
1882
1887
menu . AddAction ( "add-named" , "Add other .." ,
1883
- "Adds a selected kind of SubmodelElement to the containing collection." ,
1884
- args : new AasxMenuListOfArgDefs ( )
1885
- . Add ( "Kind" , "Name (not abbreviated) of kind of SubmodelElement." ) ) ;
1888
+ "Adds a selected kind of SubmodelElement to the containing collection." ,
1889
+ args : new AasxMenuListOfArgDefs ( )
1890
+ . Add ( "Kind" , "Name (not abbreviated) of kind of SubmodelElement." ) ) ;
1886
1891
1892
+ // 4
1887
1893
if ( smtElemItem . Count > 0 )
1888
1894
{
1889
1895
menu . AddAction ( "add-smt-guided" , "Add SMT guided .." ,
@@ -1935,16 +1941,9 @@ public void DispSmeListAddNewHelper<T>(
1935
1941
defaultHelper : Options . Curr . GetCreateDefaultHelper ( ) ) ;
1936
1942
1937
1943
// add
1938
- T smw = sme2 ;
1939
- if ( smeList == null )
1940
- {
1941
- smeList = new List < T > ( ) ;
1942
- setValueLambda ? . Invoke ( smeList ) ;
1943
- }
1944
-
1945
1944
smeList = smeList ?? new List < T > ( ) ;
1946
- smeList . Add ( smw ) ;
1947
- setValueLambda ( smeList ) ;
1945
+ smeList . Add ( sme2 ) ;
1946
+ setOutput ? . Invoke ( smeList ) ;
1948
1947
1949
1948
// make some more adjustments
1950
1949
if ( sme2 is IMultiLanguageProperty mlp )
@@ -2007,12 +2006,11 @@ public void DispSmeListAddNewHelper<T>(
2007
2006
item . SmtRec . PopulateReferable ( sme , item . Cd ) ;
2008
2007
2009
2008
// add & confirm
2010
- var smw = sme as T ;
2011
- if ( smw != null )
2009
+ if ( sme != null )
2012
2010
{
2013
2011
smeList = smeList ?? new List < T > ( ) ;
2014
- smeList . Add ( smw ) ;
2015
- setValueLambda ( smeList ) ;
2012
+ smeList . Add ( sme ) ;
2013
+ setOutput ( smeList ) ;
2016
2014
2017
2015
this . AddDiaryEntry ( sme , new DiaryEntryStructChange (
2018
2016
StructuralChangeReason . Create ) ) ;
0 commit comments