Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions Src/FdoUi/PhonologicalFeatureEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,19 @@ public BulkEditBarPhonologicalFeatures(BrowseViewer bv, XmlNode spec, Mediator m
EnablePreviewApplyForListChoice();
}

// The currently active bulk edit item (if any).
internal BulkEditItem CurrentItem
{
get
{
if (m_beItems == null)
return null;
if (m_itemIndex < 0 || m_itemIndex >= m_beItems.Length)
return null;
return m_beItems[m_itemIndex];
}
}

void BulkEditBarPhonologicalFeatures_EnableTargetFeatureCombo(object sender, TargetFeatureEventArgs e)
{
TargetCombo.Enabled = e.Enable;
Expand All @@ -714,8 +727,8 @@ protected override void ShowPreviewItems(ProgressState state)
{
m_bv.BrowseView.Vc.MultiColumnPreview = false;
var itemsToChange = ItemsToChange(false);
BulkEditItem bei = m_beItems[m_itemIndex];
var phonFeatEditor = bei.BulkEditControl as PhonologicalFeatureEditor;
BulkEditItem bei = CurrentItem;
var phonFeatEditor = bei?.BulkEditControl as PhonologicalFeatureEditor;
if (phonFeatEditor == null)
{ // User chose to remove the targeted feature
bei.BulkEditControl.FakeDoit(itemsToChange, XMLViewsDataCache.ktagAlternateValue,
Expand Down Expand Up @@ -775,8 +788,8 @@ protected override void ShowPreviewItems(ProgressState state)
/// </summary>
protected override void PreUpdateColumnList()
{
BulkEditItem bei = m_beItems[m_itemIndex];
if (bei.BulkEditControl is PhonologicalFeatureEditor phonFeatEditor)
BulkEditItem bei = CurrentItem;
if (bei?.BulkEditControl is PhonologicalFeatureEditor phonFeatEditor)
{
m_currentFeatDefnAbbr = phonFeatEditor.FeatDefnAbbr;
m_currentSelectedHvo = phonFeatEditor.SelectedHvo;
Expand All @@ -790,8 +803,8 @@ protected override void PreUpdateColumnList()
/// </summary>
protected override void PostUpdateColumnList()
{
BulkEditItem bei = m_beItems[m_itemIndex];
if (bei.BulkEditControl is PhonologicalFeatureEditor phonFeatEditor &&
BulkEditItem bei = CurrentItem;
if (bei?.BulkEditControl is PhonologicalFeatureEditor phonFeatEditor &&
phonFeatEditor.FeatDefnAbbr == m_currentFeatDefnAbbr)
{
phonFeatEditor.SelectedHvo = m_currentSelectedHvo;
Expand Down
Loading