Skip to content

Commit a440f7a

Browse files
committed
* various updates
* fix order of paste into * Note: sequence of selection does matter
1 parent 48f4474 commit a440f7a

File tree

7 files changed

+45
-9
lines changed

7 files changed

+45
-9
lines changed

src/AasxCsharpLibrary/Extensions/ExtendExtension.cs

+7
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ This source code is licensed under the Apache License 2.0 (see LICENSE.txt).
66
77
This source code may use other Open Source software components (see LICENSE.txt).
88
*/
9+
using AdminShellNS;
910
using System;
1011
using System.Collections.Generic;
1112
using System.Text.RegularExpressions;
@@ -25,5 +26,11 @@ public static bool IsValid(this List<IExtension> elems)
2526
return true;
2627
}
2728

29+
public static bool IsOneBlank(this List<IExtension> elems)
30+
{
31+
if (elems == null || elems.Count != 1)
32+
return false;
33+
return elems[0].Value?.HasContent() != true;
34+
}
2835
}
2936
}

src/AasxCsharpLibrary/Extensions/ExtendQualifier.cs

+8
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ This source code is licensed under the Apache License 2.0 (see LICENSE.txt).
66
77
This source code may use other Open Source software components (see LICENSE.txt).
88
*/
9+
using AdminShellNS;
910
using System;
1011
using System.Collections.Generic;
1112
using System.Text.RegularExpressions;
@@ -140,6 +141,13 @@ public static bool IsValid(this List<IQualifier> elems)
140141
return true;
141142
}
142143

144+
public static bool IsOneBlank(this List<IQualifier> elems)
145+
{
146+
if (elems == null || elems.Count != 1)
147+
return false;
148+
return elems[0].Value?.HasContent() != true;
149+
}
150+
143151
public static IQualifier FindQualifierOfType(this IEnumerable<IQualifier> qualifiers, string qualifierType)
144152
{
145153
if (qualifiers == null || qualifierType == null)

src/AasxPackageExplorer/options-debug.MIHO.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@
3131
// "AasxToLoad": "C:\\HOMI\\Develop\\Aasx\\repo\\samm-test\\Run2_DNP_plus_CD_SM_step_2.aasx",
3232
// "AasxToLoad": "C:\\HOMI\\Develop\\Aasx\\repo\\Test1.aasx",
3333
// "AasxToLoad": "C:\\HOMI\\Develop\\Aasx\\repo\\samm-test\\SMT_and_SAMM_Showcase_v02.aasx",
34+
"AasxToLoad": "C:\\Users\\homi0002\\Desktop\\SMT_TechData_Work\\IDTA 02003-1-2_SubmodelTemplate_TechnicalData_v1.3_workingFile_MIHO.aasx",
3435
// "AasxToLoad": "C:\\Users\\homi0002\\Desktop\\tmp\\SMT_and_SAMM_Showcase_v02_spiel.aasx",
3536
// "AasxToLoad": "C:\\Users\\homi0002\\Desktop\\tmp\\SMT_ProductChangeNotification_Draft_v19_spiel.aasx",
3637
// "AasxToLoad": "C:\\Users\\homi0002\\Desktop\\tmp\\00_FestoDemoBox-Module-2-Kopie.aasx",
3738
// "AasxToLoad": "C:\\Users\\homi0002\\Desktop\\tmp\\8001203_SPAU-P10R-T-R18M-L-PNLK-PNVBA-M8D_060ff64f-9fd2-422d-81ce-b17e49f007c5_work_spiel.aasx",
38-
"AasxToLoad": "C:\\MIHO\\Develop\\Aasx\\repo\\SMT_and_SAMM_Showcase_v02.aasx",
39+
// "AasxToLoad": "C:\\MIHO\\Develop\\Aasx\\repo\\SMT_and_SAMM_Showcase_v02.aasx",
3940
// "AasxToLoad": "C:\\MIHO\\Develop\\Aasx\\repo\\SMT_and_SAMM_Showcase_v01.aasx",
4041
// "AasxToLoad": "C:\\HOMI\\Develop\\Aasx\\repo\\SAMSON_TROVIS_3730-3_Vorlage_Demo_Achema.aasx",
4142
// "AasxToLoad": "C:\\Users\\homi0002\\Desktop\\Prototyp_DPP_SkillsConveyor\\Prototyp_SkillsConveyor.aasx",

src/AasxPackageLogic/DispEditHelperCopyPaste.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -568,9 +568,9 @@ public void DispSmeCutCopyPasteHelper(
568568
// the sequence of adding childs might by altered in order to preserve
569569
// original order of elements
570570
var itemsInOrder = cpb.Items;
571-
if (buttonNdx != 2)
571+
if (buttonNdx == 3)
572572
{
573-
// paste below, paste into will use reversing
573+
// paste below into will use reversing
574574
itemsInOrder.Reverse();
575575
}
576576

src/AasxPackageLogic/DispEditHelperEntities.cs

+11-4
Original file line numberDiff line numberDiff line change
@@ -4454,14 +4454,21 @@ public void DisplayOrEditAasEntitySubmodelElement(
44544454
return new AnyUiLambdaActionNavigateTo(sml.SemanticIdListElement);
44554455
},
44564456
relatedReferable: sml,
4457-
auxContextHeader: new[] { "\u2573", "Delete semanticIdListElement" },
4457+
auxContextHeader: new[] { "\U0001F796", "Auto-detect" },
44584458
auxContextLambda: (i) =>
44594459
{
44604460
if (i == 0)
44614461
{
4462-
sml.SemanticIdListElement = null;
4463-
this.AddDiaryEntry(sml, new DiaryEntryStructChange());
4464-
return new AnyUiLambdaActionRedrawEntity();
4462+
// check for underlying SMCs
4463+
if (sml.Value != null && sml.Value.Count > 0
4464+
&& sml.Value.First() is Aas.ISubmodelElementCollection subsmc
4465+
&& subsmc.SemanticId?.IsValid() == true)
4466+
{
4467+
sml.SemanticIdListElement = subsmc.SemanticId.Copy();
4468+
4469+
this.AddDiaryEntry(sml, new DiaryEntryStructChange());
4470+
return new AnyUiLambdaActionRedrawEntity();
4471+
}
44654472
}
44664473
return new AnyUiLambdaActionNone();
44674474
});

src/AasxPackageLogic/DispEditHelperMiniModules.cs

+10
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,11 @@ public void QualifierHelper(
216216
if (uc.Result && uc.ResultItem?.Tag is QualifierPreset preset
217217
&& preset.qualifier != null)
218218
{
219+
// if qualifiers is actually containing only one
220+
// "blank" qualifier, replace this
221+
if (qualifiers.IsOneBlank())
222+
qualifiers.RemoveAt(0);
223+
219224
qualifiers.Add(preset.qualifier);
220225
this.AddDiaryEntry(relatedReferable, new DiaryEntryStructChange());
221226
}
@@ -925,6 +930,11 @@ public void ExtensionHelper(
925930
if (uc.Result && uc.ResultItem?.Tag is ExtensionPreset preset
926931
&& preset.extension != null)
927932
{
933+
// if extensions is actually containing only one
934+
// "blank" extension, replace this
935+
if (extensions.IsOneBlank())
936+
extensions.RemoveAt(0);
937+
928938
extensions.Add(preset.extension);
929939
this.AddDiaryEntry(relatedReferable, new DiaryEntryStructChange());
930940
}

src/BlazorExplorer/BlazorVisualElements.cs

+5-2
Original file line numberDiff line numberDiff line change
@@ -346,10 +346,13 @@ public bool TrySelectVisualElement(VisualElementGeneric ve, bool? wishExpanded)
346346
/// Carefully checks and tries to select a tree item which is identified
347347
/// by the main data object (e.g. an AAS, SME, ..)
348348
/// </summary>
349-
public bool TrySelectMainDataObject(object dataObject, bool? wishExpanded)
349+
public bool TrySelectMainDataObject(
350+
object dataObject, bool? wishExpanded,
351+
bool alsoDereferenceObjects = false)
350352
{
351353
// access?
352-
var ve = SearchVisualElementOnMainDataObject(dataObject);
354+
var ve = SearchVisualElementOnMainDataObject(dataObject,
355+
alsoDereferenceObjects: alsoDereferenceObjects);
353356
if (ve == null)
354357
return false;
355358

0 commit comments

Comments
 (0)