public virtual bool OnDisplayDataTreeDelete(object commandObject,
ref UIItemDisplayProperties display)
{
Slice current = m_dataEntryForm.CurrentSlice;
if (current == null || current.Object == null || current.IsGhostSlice)
{
display.Enabled = false;
display.Visible = false;
return true;
}
// NB (JH): this will prove too simplistic when we have an atomic attribute
// which takes more than 1 base class. in that case, this will prevent the user from
// deleting the existing object of type X in order to replace it with one of type Y.
display.Enabled = current != null && current.GetCanDeleteNow();
// if(current.GetObjectHvoForMenusToOperateOn() == m_dataEntryForm.Root.Hvo && !current.WrapsAtomic)
// {
// display.Enabled = false;
// display.Text += StringTbl.GetString("(Programming error: would delete this record.)");
// }
// else
if(!display.Enabled)
display.Text += StringTbl.GetString("(cannot delete this)");
if (display.Text.Contains("{0}"))
{
// Insert the class name of the thing we will delete
var obj = current.GetObjectForMenusToOperateOn();
if (obj != null)
display.Text = string.Format(display.Text, m_mediator.StringTbl.GetString(obj.ClassName, "ClassNames"));
}
return true;//we handled this, no need to ask anyone else.
}
/// <summary>