SIL.FieldWorks.XWorks.DTMenuHandler.OnDisplayAddComponentToPrimary C# (CSharp) Method

OnDisplayAddComponentToPrimary() private method

private OnDisplayAddComponentToPrimary ( object commandObject, XCore.UIItemDisplayProperties &display ) : bool
commandObject object
display XCore.UIItemDisplayProperties
return bool
		public bool OnDisplayAddComponentToPrimary(object commandObject, ref UIItemDisplayProperties display)
		{
			Slice current = m_dataEntryForm.CurrentSlice;
			if (current == null || current.Object == null || current.Flid == 0)
				return true; // already handled - nothing else should be responding to this message
			bool fEnable = false;
			bool fChecked = false;
			Command command = (Command)commandObject;
			string className = XmlUtils.GetManditoryAttributeValue(command.Parameters[0], "className");
			if (className == current.Object.ClassName)
			{
				string tool = XmlUtils.GetOptionalAttributeValue(command.Parameters[0], "tool");
				if (tool == null || tool == m_mediator.PropertyTable.GetStringProperty("currentContentControl", String.Empty))
				{
					int hvo = GetSelectedComponentHvo();
					var ler = current.Object as ILexEntryRef;
					if (hvo != 0)
					{
						ICmObject target = Cache.ServiceLocator.GetInstance<ICmObjectRepository>().GetObject(hvo);
						if (ler != null && ler.RefType == LexEntryRefTags.krtComplexForm &&
							(target is ILexEntry || target is ILexSense))
						{
							fEnable = true;
							fChecked = ler.PrimaryLexemesRS.Contains(target); // LT-11292
						}
					}
				}
			}
			display.Visible = display.Enabled = fEnable;
			display.Checked = fChecked;
			return true;
		}