From 5bf8266d8a82f8f300532b8979cecaede714ff41 Mon Sep 17 00:00:00 2001
From: mark-sil <83427558+mark-sil@users.noreply.github.com>
Date: Tue, 14 Apr 2026 15:10:50 -0400
Subject: [PATCH 1/2] LT-21517: Implement DialogInsertItemInVector in Pub/Sub
system
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add a ReturnObject class to return a ‘handled’ value, which the
Publisher needs to know. All of the Subscribers only handle a
specific className or className and Id combination so it did not
matter that two of the classes are derived from DlgListenerBase,
which has ColleaguePriority.High.
---
Src/Common/FwUtils/EndOfActionManager.cs | 2 +-
Src/Common/FwUtils/EventConstants.cs | 1 +
Src/Common/FwUtils/Publisher.cs | 4 +-
.../FwUtils/PublisherParameterObject.cs | 21 ++++++--
.../LexTextControls/EntryDlgListener.cs | 45 +++++++++++++----
.../LexTextControls/RecordDlgListener.cs | 48 +++++++++++++++---
.../Morphology/MasterCatDlgListener.cs | 42 ++++++++++++----
Src/LexText/Morphology/MasterDlgListener.cs | 15 ------
.../Morphology/MasterInflFeatDlgListener.cs | 49 ++++++++++++++-----
.../Morphology/MasterPhonFeatDlgListener.cs | 49 ++++++++++++++-----
Src/xWorks/RecordClerk.cs | 6 +--
11 files changed, 210 insertions(+), 72 deletions(-)
diff --git a/Src/Common/FwUtils/EndOfActionManager.cs b/Src/Common/FwUtils/EndOfActionManager.cs
index 784a74e7c4..d243a62458 100644
--- a/Src/Common/FwUtils/EndOfActionManager.cs
+++ b/Src/Common/FwUtils/EndOfActionManager.cs
@@ -52,7 +52,7 @@ internal void AddEvent(PublisherParameterObject publisherParameterObject)
}
// Add the dictionary entry if the key is not present. Overwrite the value if the key is present.
- m_events[publisherParameterObject.Message] = publisherParameterObject.NewValue;
+ m_events[publisherParameterObject.Message] = publisherParameterObject.Data;
}
/// Should be private, but is public to support testing.
diff --git a/Src/Common/FwUtils/EventConstants.cs b/Src/Common/FwUtils/EventConstants.cs
index 2c162065b8..5ca95ff8b6 100644
--- a/Src/Common/FwUtils/EventConstants.cs
+++ b/Src/Common/FwUtils/EventConstants.cs
@@ -14,6 +14,7 @@ public static class EventConstants
public const string CreateFirstRecord = "CreateFirstRecord";
public const string DataTreeDelete = "DataTreeDelete";
public const string DeleteRecord = "DeleteRecord";
+ public const string DialogInsertItemInVector = "DialogInsertItemInVector";
public const string DictionaryConfigured = "DictionaryConfigured";
public const string FilterListChanged = "FilterListChanged";
public const string FollowLink = "FollowLink";
diff --git a/Src/Common/FwUtils/Publisher.cs b/Src/Common/FwUtils/Publisher.cs
index 36f662da9d..672c763059 100644
--- a/Src/Common/FwUtils/Publisher.cs
+++ b/Src/Common/FwUtils/Publisher.cs
@@ -70,7 +70,7 @@ public void Publish(PublisherParameterObject publisherParameterObject)
{
Guard.AgainstNull(publisherParameterObject, nameof(publisherParameterObject));
- PublishMessage(publisherParameterObject.Message, publisherParameterObject.NewValue);
+ PublishMessage(publisherParameterObject.Message, publisherParameterObject.Data);
}
///
@@ -89,7 +89,7 @@ public void Publish(IList publisherParameterObjects)
foreach (var publisherParameterObject in publisherParameterObjects)
{
- PublishMessage(publisherParameterObject.Message, publisherParameterObject.NewValue);
+ PublishMessage(publisherParameterObject.Message, publisherParameterObject.Data);
}
}
#endregion
diff --git a/Src/Common/FwUtils/PublisherParameterObject.cs b/Src/Common/FwUtils/PublisherParameterObject.cs
index 06ecade733..93a8d8a4a7 100644
--- a/Src/Common/FwUtils/PublisherParameterObject.cs
+++ b/Src/Common/FwUtils/PublisherParameterObject.cs
@@ -8,7 +8,7 @@ namespace SIL.FieldWorks.Common.FwUtils
{
public sealed class PublisherParameterObject
{
- public PublisherParameterObject(string message, object newValue = null)
+ public PublisherParameterObject(string message, object data = null)
{
if (string.IsNullOrWhiteSpace(message))
{
@@ -16,10 +16,25 @@ public PublisherParameterObject(string message, object newValue = null)
}
Message = message;
- NewValue = newValue;
+ Data = data;
}
public string Message { get; }
- public object NewValue { get; }
+ public object Data { get; }
+ }
+
+ ///
+ /// Convenience class for use when we want to pass a return value back through the PublisherParameterObject.
+ ///
+ public class ReturnObject
+ {
+ public ReturnObject(object data)
+ {
+ Data = data;
+ ReturnValue = false;
+ }
+
+ public object Data { get; set; }
+ public bool ReturnValue { get; set; }
}
}
\ No newline at end of file
diff --git a/Src/LexText/LexTextControls/EntryDlgListener.cs b/Src/LexText/LexTextControls/EntryDlgListener.cs
index d7c31e7de2..57fd083923 100644
--- a/Src/LexText/LexTextControls/EntryDlgListener.cs
+++ b/Src/LexText/LexTextControls/EntryDlgListener.cs
@@ -7,6 +7,8 @@
using System;
using System.Diagnostics;
using System.Windows.Forms;
+using SIL.FieldWorks.Common.FwUtils;
+using static SIL.FieldWorks.Common.FwUtils.FwUtils;
using SIL.LCModel;
using SIL.LCModel.Infrastructure;
using XCore;
@@ -32,28 +34,51 @@ protected override string PersistentLabel
public InsertEntryDlgListener()
{
+ Subscriber.Subscribe(EventConstants.DialogInsertItemInVector, DialogInsertItemInVector);
}
#endregion Construction and Initialization
+ #region IDisposable
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ Subscriber.Unsubscribe(EventConstants.DialogInsertItemInVector, DialogInsertItemInVector);
+ }
+ base.Dispose(disposing);
+ }
+ #endregion IDisposable
+
#region XCORE Message Handlers
///
- /// Handles the xWorks message to insert a new lexical entry.
+ /// Handles the message to insert a new lexical entry.
/// Invoked by the RecordClerk
///
- /// The xCore Command object.
- /// true, if we handled the message, otherwise false, if there was an unsupported 'classname' parameter
- public bool OnDialogInsertItemInVector(object argument)
+ /// Object that contains the xCore Command object and has a ReturnValue. The
+ /// ReturnValue is true if we handled the message.
+ private void DialogInsertItemInVector(object obj)
{
CheckDisposed();
- Debug.Assert(argument != null && argument is XCore.Command);
- string className = XmlUtils.GetOptionalAttributeValue(
- (argument as Command).Parameters[0],
- "className");
+ if (!(obj is ReturnObject retObj) ||
+ !(retObj.Data is Command command))
+ {
+ Debug.Assert(false, "Received unexpected object type.");
+ return;
+ }
+ // Return if already handled by another Subscriber.
+ if (retObj.ReturnValue)
+ {
+ return;
+ }
+ // Only handle "LexEntry" class.
+ string className = XmlUtils.GetOptionalAttributeValue(command.Parameters[0], "className");
if (className == null || className != "LexEntry")
- return false;
+ {
+ return;
+ }
using (InsertEntryDlg dlg = new InsertEntryDlg())
{
@@ -72,7 +97,7 @@ public bool OnDialogInsertItemInVector(object argument)
#pragma warning restore 618
}
}
- return true; // We "handled" the message, regardless of what happened.
+ retObj.ReturnValue = true; // We "handled" the message, regardless of what happened.
}
#endregion XCORE Message Handlers
diff --git a/Src/LexText/LexTextControls/RecordDlgListener.cs b/Src/LexText/LexTextControls/RecordDlgListener.cs
index 0cb4a8145f..ab655220cb 100644
--- a/Src/LexText/LexTextControls/RecordDlgListener.cs
+++ b/Src/LexText/LexTextControls/RecordDlgListener.cs
@@ -4,6 +4,8 @@
using System.Diagnostics;
using System.Windows.Forms;
+using SIL.FieldWorks.Common.FwUtils;
+using static SIL.FieldWorks.Common.FwUtils.FwUtils;
using SIL.LCModel;
using SIL.Utils;
using XCore;
@@ -24,23 +26,55 @@ protected override string PersistentLabel
#endregion Properties
+ #region Construction and Initialization
+
+ public InsertRecordDlgListener()
+ {
+ Subscriber.Subscribe(EventConstants.DialogInsertItemInVector, DialogInsertItemInVector);
+ }
+
+ #endregion Construction and Initialization
+
+ #region IDisposable
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ Subscriber.Unsubscribe(EventConstants.DialogInsertItemInVector, DialogInsertItemInVector);
+ }
+ base.Dispose(disposing);
+ }
+ #endregion IDisposable
#region XCORE Message Handlers
///
- /// Handles the xWorks message to insert a new Data Notebook record.
+ /// Handles the message to insert a new Data Notebook record.
/// Invoked by the RecordClerk
///
- /// The xCore Command object.
- /// true, if we handled the message, otherwise false, if there was an unsupported 'classname' parameter
- public bool OnDialogInsertItemInVector(object argument)
+ /// Object that contains the xCore Command object and has a ReturnValue. The
+ /// ReturnValue is true if we handled the message.
+ private void DialogInsertItemInVector(object arg)
{
CheckDisposed();
- var command = (Command) argument;
+ if (!(arg is ReturnObject retObj) ||
+ !(retObj.Data is Command command))
+ {
+ Debug.Assert(false, "Received unexpected object type.");
+ return;
+ }
+ // Return if already handled by another Subscriber.
+ if (retObj.ReturnValue)
+ {
+ return;
+ }
+ // Only handle "RnGenericRec" class.
string className = XmlUtils.GetOptionalAttributeValue(command.Parameters[0], "className");
if (className == null || className != "RnGenericRec")
- return false;
+ {
+ return;
+ }
bool subrecord = XmlUtils.GetOptionalBooleanAttributeValue(command.Parameters[0], "subrecord", false);
bool subsubrecord = XmlUtils.GetOptionalBooleanAttributeValue(command.Parameters[0], "subsubrecord", false);
@@ -74,7 +108,7 @@ public bool OnDialogInsertItemInVector(object argument)
#pragma warning restore 618
}
}
- return true; // We "handled" the message, regardless of what happened.
+ retObj.ReturnValue = true; // We "handled" the message, regardless of what happened.
}
#endregion XCORE Message Handlers
diff --git a/Src/LexText/Morphology/MasterCatDlgListener.cs b/Src/LexText/Morphology/MasterCatDlgListener.cs
index e1c7470cf2..88d37d6136 100644
--- a/Src/LexText/Morphology/MasterCatDlgListener.cs
+++ b/Src/LexText/Morphology/MasterCatDlgListener.cs
@@ -4,9 +4,12 @@
using System.Diagnostics;
using System.Windows.Forms;
+using SIL.FieldWorks.Common.FwUtils;
+using static SIL.FieldWorks.Common.FwUtils.FwUtils;
using SIL.LCModel;
using SIL.FieldWorks.LexText.Controls;
using SIL.Utils;
+using XCore;
namespace SIL.FieldWorks.XWorks.MorphologyEditor
{
@@ -32,6 +35,7 @@ protected override string PersistentLabel
///
public MasterCatDlgListener()
{
+ Subscriber.Subscribe(EventConstants.DialogInsertItemInVector, DialogInsertItemInVector);
}
#endregion Construction and Initialization
@@ -52,26 +56,46 @@ public MasterCatDlgListener()
// The base class finalizer is called automatically.
}
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ Subscriber.Unsubscribe(EventConstants.DialogInsertItemInVector, DialogInsertItemInVector);
+ }
+ base.Dispose(disposing);
+ }
#endregion IDisposable & Co. implementation
#region XCORE Message Handlers
///
- /// Handles the xWorks message to insert a new PartOfSpeech.
+ /// Handles the message to insert a new PartOfSpeech.
/// Invoked by the RecordClerk via a main menu.
///
- /// The xCore Command object.
- /// true, if we handled the message, otherwise false, if there was an unsupported 'classname' parameter
- public override bool OnDialogInsertItemInVector(object argument)
+ /// Object that contains the xCore Command object and has a ReturnValue. The
+ /// ReturnValue is true if we handled the message.
+ private void DialogInsertItemInVector(object obj)
{
CheckDisposed();
- Debug.Assert(argument != null && argument is XCore.Command);
- string className = XmlUtils.GetOptionalAttributeValue(
- (argument as XCore.Command).Parameters[0], "className");
+ if (!(obj is ReturnObject retObj) ||
+ !(retObj.Data is Command command))
+ {
+ Debug.Assert(false, "Received unexpected object type.");
+ return;
+ }
+ // Return if already handled by another Subscriber.
+ if (retObj.ReturnValue)
+ {
+ return;
+ }
+ // Only handle "PartOfSpeech" class.
+ string className = XmlUtils.GetOptionalAttributeValue(command.Parameters[0], "className");
if (className == null || className != "PartOfSpeech")
- return false;
+ {
+ return;
+ }
using (var dlg = new MasterCategoryListDlg())
{
@@ -91,7 +115,7 @@ public override bool OnDialogInsertItemInVector(object argument)
break;
}
}
- return true; // We "handled" the message, regardless of what happened.
+ retObj.ReturnValue = true; // We "handled" the message, regardless of what happened.
}
#endregion XCORE Message Handlers
diff --git a/Src/LexText/Morphology/MasterDlgListener.cs b/Src/LexText/Morphology/MasterDlgListener.cs
index c165d7ca8e..841bb7867e 100644
--- a/Src/LexText/Morphology/MasterDlgListener.cs
+++ b/Src/LexText/Morphology/MasterDlgListener.cs
@@ -193,20 +193,5 @@ public int Priority
}
#endregion IxCoreColleague implementation
-
- #region XCORE Message Handlers
-
- ///
- /// Handles the xWorks message to insert a new class.
- /// Invoked by the RecordClerk via a main menu.
- ///
- /// The xCore Command object.
- /// true, if we handled the message, otherwise false, if there was an unsupported 'classname' parameter
- public virtual bool OnDialogInsertItemInVector(object argument)
- {
- return false; // Needs to be handled by the override method
- }
-
- #endregion XCORE Message Handlers
}
}
diff --git a/Src/LexText/Morphology/MasterInflFeatDlgListener.cs b/Src/LexText/Morphology/MasterInflFeatDlgListener.cs
index 34629c7893..53db0b219b 100644
--- a/Src/LexText/Morphology/MasterInflFeatDlgListener.cs
+++ b/Src/LexText/Morphology/MasterInflFeatDlgListener.cs
@@ -4,9 +4,12 @@
using System.Diagnostics;
using System.Windows.Forms;
+using SIL.FieldWorks.Common.FwUtils;
+using static SIL.FieldWorks.Common.FwUtils.FwUtils;
using SIL.LCModel;
using SIL.FieldWorks.LexText.Controls;
using SIL.Utils;
+using XCore;
namespace SIL.FieldWorks.XWorks.MorphologyEditor
{
@@ -33,6 +36,7 @@ protected override string PersistentLabel
///
public MasterInflFeatDlgListener()
{
+ Subscriber.Subscribe(EventConstants.DialogInsertItemInVector, DialogInsertItemInVector);
}
#endregion Construction and Initialization
@@ -53,28 +57,51 @@ public MasterInflFeatDlgListener()
// The base class finalizer is called automatically.
}
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ Subscriber.Unsubscribe(EventConstants.DialogInsertItemInVector, DialogInsertItemInVector);
+ }
+ base.Dispose(disposing);
+ }
#endregion IDisposable & Co. implementation
#region XCORE Message Handlers
///
- /// Handles the xWorks message to insert a new FsFeatDefn.
+ /// Handles the message to insert a new FsFeatDefn.
/// Invoked by the RecordClerk via a main menu.
///
- /// The xCore Command object.
- /// true, if we handled the message, otherwise false, if there was an unsupported 'classname' parameter
- public override bool OnDialogInsertItemInVector(object argument)
+ /// Object that contains the xCore Command object and has a ReturnValue. The
+ /// ReturnValue is true if we handled the message.
+ private void DialogInsertItemInVector(object obj)
{
CheckDisposed();
- Debug.Assert(argument != null && argument is XCore.Command);
- string className = XmlUtils.GetOptionalAttributeValue(
- (argument as XCore.Command).Parameters[0], "className");
+ if (!(obj is ReturnObject retObj) ||
+ !(retObj.Data is Command command))
+ {
+ Debug.Assert(false, "Received unexpected object type.");
+ return;
+ }
+ // Return if already handled by another Subscriber.
+ if (retObj.ReturnValue)
+ {
+ return;
+ }
+ // Only handle "FsClosedFeature" and "FsComplexFeature" classes.
+ string className = XmlUtils.GetOptionalAttributeValue(command.Parameters[0], "className");
if (className == null || ((className != "FsClosedFeature") && (className != "FsComplexFeature")))
- return false;
- if (className == "FsClosedFeature" && (argument as XCore.Command).Id != "CmdInsertClosedFeature")
- return false;
+ {
+ return;
+ }
+ // Only handle "FsClosedFeature" for "CmdInsertClosedFeature".
+ if (className == "FsClosedFeature" && command.Id != "CmdInsertClosedFeature")
+ {
+ return;
+ }
using (MasterInflectionFeatureListDlg dlg = new MasterInflectionFeatureListDlg(className))
{
@@ -101,7 +128,7 @@ public override bool OnDialogInsertItemInVector(object argument)
break;
}
}
- return true; // We "handled" the message, regardless of what happened.
+ retObj.ReturnValue = true; // We "handled" the message, regardless of what happened.
}
#endregion XCORE Message Handlers
diff --git a/Src/LexText/Morphology/MasterPhonFeatDlgListener.cs b/Src/LexText/Morphology/MasterPhonFeatDlgListener.cs
index 07d5c1f419..b732b7c6d0 100644
--- a/Src/LexText/Morphology/MasterPhonFeatDlgListener.cs
+++ b/Src/LexText/Morphology/MasterPhonFeatDlgListener.cs
@@ -9,8 +9,10 @@
using SIL.LCModel;
using SIL.FieldWorks.LexText.Controls;
using SIL.FieldWorks.Common.FwUtils;
+using static SIL.FieldWorks.Common.FwUtils.FwUtils;
using SIL.LCModel.Infrastructure;
using SIL.Utils;
+using XCore;
namespace SIL.FieldWorks.XWorks.MorphologyEditor
{
@@ -37,6 +39,7 @@ protected override string PersistentLabel
///
public MasterPhonFeatDlgListener()
{
+ Subscriber.Subscribe(EventConstants.DialogInsertItemInVector, DialogInsertItemInVector);
}
#endregion Construction and Initialization
@@ -57,27 +60,51 @@ public MasterPhonFeatDlgListener()
// The base class finalizer is called automatically.
}
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ Subscriber.Unsubscribe(EventConstants.DialogInsertItemInVector, DialogInsertItemInVector);
+ }
+ base.Dispose(disposing);
+ }
+
#endregion IDisposable & Co. implementation
#region XCORE Message Handlers
///
- /// Handles the xWorks message to insert a new FsFeatDefn.
+ /// Handles the message to insert a new FsFeatDefn.
/// Invoked by the RecordClerk via a main menu.
///
- /// The xCore Command object.
- /// true, if we handled the message, otherwise false, if there was an unsupported 'classname' parameter
- public override bool OnDialogInsertItemInVector(object argument)
+ /// Object that contains the xCore Command object and has a ReturnValue. The
+ /// ReturnValue is true if we handled the message.
+ private void DialogInsertItemInVector(object obj)
{
CheckDisposed();
- Debug.Assert(argument != null && argument is XCore.Command);
- string className = XmlUtils.GetOptionalAttributeValue(
- (argument as XCore.Command).Parameters[0], "className");
+ if (!(obj is ReturnObject retObj) ||
+ !(retObj.Data is Command command))
+ {
+ Debug.Assert(false, "Received unexpected object type.");
+ return;
+ }
+ // Return if already handled by another Subscriber.
+ if (retObj.ReturnValue)
+ {
+ return;
+ }
+ // Only handle "FsClosedFeature" class.
+ string className = XmlUtils.GetOptionalAttributeValue(command.Parameters[0], "className");
if ((className == null) || (className != "FsClosedFeature"))
- return false;
- if (className == "FsClosedFeature" && (argument as XCore.Command).Id != "CmdInsertPhonologicalClosedFeature")
- return false;
+ {
+ return;
+ }
+ // Only handle "FsClosedFeature" for "CmdInsertPhonologicalClosedFeature".
+ if (className == "FsClosedFeature" && command.Id != "CmdInsertPhonologicalClosedFeature")
+ {
+ return;
+ }
using (MasterPhonologicalFeatureListDlg dlg = new MasterPhonologicalFeatureListDlg(className))
{
@@ -118,7 +145,7 @@ public override bool OnDialogInsertItemInVector(object argument)
break;
}
}
- return true; // We "handled" the message, regardless of what happened.
+ retObj.ReturnValue = true; // We "handled" the message, regardless of what happened.
}
#endregion XCORE Message Handlers
diff --git a/Src/xWorks/RecordClerk.cs b/Src/xWorks/RecordClerk.cs
index 6dc6970387..bb50363496 100644
--- a/Src/xWorks/RecordClerk.cs
+++ b/Src/xWorks/RecordClerk.cs
@@ -2551,10 +2551,10 @@ public bool OnInsertItemInVector(object argument)
m_suppressSaveOnChangeRecord = true;
try
{
-#pragma warning disable 618 // suppress obsolete warning
- if (m_mediator.SendMessage("DialogInsertItemInVector", argument))
+ var retObj = new ReturnObject(argument);
+ Publisher.Publish(new PublisherParameterObject(EventConstants.DialogInsertItemInVector, retObj));
+ if (retObj.ReturnValue)
return true;
-#pragma warning restore 618
}
finally
{
From a908ab6dcae07bd67613ed00124812f96c751358 Mon Sep 17 00:00:00 2001
From: mark-sil <83427558+mark-sil@users.noreply.github.com>
Date: Wed, 15 Apr 2026 09:20:08 -0400
Subject: [PATCH 2/2] Code cleanup, in response to review comments
---
Src/LexText/LexTextControls/EntryDlgListener.cs | 2 +-
Src/LexText/LexTextControls/RecordDlgListener.cs | 2 +-
Src/LexText/Morphology/MasterCatDlgListener.cs | 2 +-
Src/LexText/Morphology/MasterInflFeatDlgListener.cs | 2 +-
Src/LexText/Morphology/MasterPhonFeatDlgListener.cs | 9 ++-------
5 files changed, 6 insertions(+), 11 deletions(-)
diff --git a/Src/LexText/LexTextControls/EntryDlgListener.cs b/Src/LexText/LexTextControls/EntryDlgListener.cs
index 57fd083923..2a91776b0f 100644
--- a/Src/LexText/LexTextControls/EntryDlgListener.cs
+++ b/Src/LexText/LexTextControls/EntryDlgListener.cs
@@ -75,7 +75,7 @@ private void DialogInsertItemInVector(object obj)
}
// Only handle "LexEntry" class.
string className = XmlUtils.GetOptionalAttributeValue(command.Parameters[0], "className");
- if (className == null || className != "LexEntry")
+ if (className != "LexEntry")
{
return;
}
diff --git a/Src/LexText/LexTextControls/RecordDlgListener.cs b/Src/LexText/LexTextControls/RecordDlgListener.cs
index ab655220cb..82458b4de4 100644
--- a/Src/LexText/LexTextControls/RecordDlgListener.cs
+++ b/Src/LexText/LexTextControls/RecordDlgListener.cs
@@ -71,7 +71,7 @@ private void DialogInsertItemInVector(object arg)
}
// Only handle "RnGenericRec" class.
string className = XmlUtils.GetOptionalAttributeValue(command.Parameters[0], "className");
- if (className == null || className != "RnGenericRec")
+ if (className != "RnGenericRec")
{
return;
}
diff --git a/Src/LexText/Morphology/MasterCatDlgListener.cs b/Src/LexText/Morphology/MasterCatDlgListener.cs
index 88d37d6136..540454fd7d 100644
--- a/Src/LexText/Morphology/MasterCatDlgListener.cs
+++ b/Src/LexText/Morphology/MasterCatDlgListener.cs
@@ -92,7 +92,7 @@ private void DialogInsertItemInVector(object obj)
}
// Only handle "PartOfSpeech" class.
string className = XmlUtils.GetOptionalAttributeValue(command.Parameters[0], "className");
- if (className == null || className != "PartOfSpeech")
+ if (className != "PartOfSpeech")
{
return;
}
diff --git a/Src/LexText/Morphology/MasterInflFeatDlgListener.cs b/Src/LexText/Morphology/MasterInflFeatDlgListener.cs
index 53db0b219b..9f7f22e245 100644
--- a/Src/LexText/Morphology/MasterInflFeatDlgListener.cs
+++ b/Src/LexText/Morphology/MasterInflFeatDlgListener.cs
@@ -93,7 +93,7 @@ private void DialogInsertItemInVector(object obj)
}
// Only handle "FsClosedFeature" and "FsComplexFeature" classes.
string className = XmlUtils.GetOptionalAttributeValue(command.Parameters[0], "className");
- if (className == null || ((className != "FsClosedFeature") && (className != "FsComplexFeature")))
+ if ((className != "FsClosedFeature") && (className != "FsComplexFeature"))
{
return;
}
diff --git a/Src/LexText/Morphology/MasterPhonFeatDlgListener.cs b/Src/LexText/Morphology/MasterPhonFeatDlgListener.cs
index b732b7c6d0..1e36f1471c 100644
--- a/Src/LexText/Morphology/MasterPhonFeatDlgListener.cs
+++ b/Src/LexText/Morphology/MasterPhonFeatDlgListener.cs
@@ -94,14 +94,9 @@ private void DialogInsertItemInVector(object obj)
{
return;
}
- // Only handle "FsClosedFeature" class.
- string className = XmlUtils.GetOptionalAttributeValue(command.Parameters[0], "className");
- if ((className == null) || (className != "FsClosedFeature"))
- {
- return;
- }
// Only handle "FsClosedFeature" for "CmdInsertPhonologicalClosedFeature".
- if (className == "FsClosedFeature" && command.Id != "CmdInsertPhonologicalClosedFeature")
+ string className = XmlUtils.GetOptionalAttributeValue(command.Parameters[0], "className");
+ if (className != "FsClosedFeature" || command.Id != "CmdInsertPhonologicalClosedFeature")
{
return;
}