LT-21757: Allow moving templates and slots up or down in Category hierarchy#270
LT-21757: Allow moving templates and slots up or down in Category hierarchy#270jtmaxwell3 merged 19 commits intorelease/9.3from
Conversation
JakeOliver28
left a comment
There was a problem hiding this comment.
Reviewable status: 0 of 9 files reviewed, 1 unresolved discussion
Src/Common/Controls/XMLViews/XmlVc.cs line 3892 at r1 (raw file):
while (partOfSpeech != null) { foreach (IMoInflAffixSlot slot in partOfSpeech.AllAffixSlots)
We can eliminate this foreach loop with a FirstOrDefault. I think this would be simpler, quicker, and more readable.
Code snippet:
while (partOfSpeech != null)
{
var matchingSlot = partOfSpeech.AllAffixSlots
.FirstOrDefault(slot => slot.Name.BestAnalysisVernacularAlternative.Text == name);
if (matchingSlot != null)
return matchingSlot;
partOfSpeech = partOfSpeech.Owner as IPartOfSpeech;
}
JakeOliver28
left a comment
There was a problem hiding this comment.
Reviewable status: 0 of 9 files reviewed, 3 unresolved discussions (waiting on @jtmaxwell3)
Src/xWorks/DTMenuHandler.cs line 624 at r1 (raw file):
while (partOfSpeech != null) { foreach (IMoInflAffixSlot slot in partOfSpeech.AllAffixSlots)
And here. Should we consolidate these GetPOSSlot methods into one since they're identical? Guessing that might not be easily doable.
Src/LexText/ParserCore/HCLoader.cs line 1503 at r1 (raw file):
while (partOfSpeech != null) { foreach (IMoInflAffixSlot slot in partOfSpeech.AllAffixSlots)
Same thing here.
|
I find Linq-style code less readable than for loops so I only use it if the for loops are hard to read. In these cases, it is easy to see what the for loop is doing, so I don't think that this is worth changing. XmlVc, DTMenuHandler, and HCLoader don't have an import in common within FieldWorks and aren't accessible to each other, so it isn't obvious where to put GetPOSSlot so that it can be shared. |
JakeOliver28
left a comment
There was a problem hiding this comment.
Reviewable status: 0 of 9 files reviewed, 3 unresolved discussions (waiting on @jtmaxwell3)
I added code to move affix templates and affix slots in the right-click menu of Template Name and Slot Name. Moving a template up will also move local slots up if it doesn't cause a conflict. Moving a template anywhere else will leave the slot in place, but will highlight the slot in the template if it is out of scope.
This is for release/9.3.
This change is