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

OnDisplayDataTreeCopy() public method

decide whether to display this tree copy Menu Item
public OnDisplayDataTreeCopy ( object commandObject, XCore.UIItemDisplayProperties &display ) : bool
commandObject object
display XCore.UIItemDisplayProperties
return bool
		public virtual bool OnDisplayDataTreeCopy(object commandObject,
			ref UIItemDisplayProperties display)
		{
			XCore.Command command = commandObject as XCore.Command;
			Slice slice = m_dataEntryForm.CurrentSlice;
			if (slice == null && m_dataEntryForm.Slices.Count > 0)
				slice = m_dataEntryForm.FieldAt(0);

			int index = -1;
			if (command != null && slice != null && !slice.IsDisposed && this.CanInsert(command, slice, out index))
			{
				display.Enabled = true;
				string toolTipInsert = display.Text.Replace("_", string.Empty);	// strip any menu keyboard accelerator marker;
				command.ToolTipInsert = toolTipInsert.ToLower();
				XmlNode node = ExtractInsertCommandParameters(command);
				if (index >= 0 && node != null && XmlUtils.GetOptionalBooleanAttributeValue(node, "displayNumber", false))
					display.Text += " " + (index + 1);
				return true;
			}
			display.Enabled = false;
			return false;
		}
		/// <summary>