public void SetupDeleteMenu(MenuItem mnuDelete) { mnuDelete.MenuItems.Clear(); int hvoDeleteOwner; int flidDelete; int ihvoDelete = -1; // default for atomic Slice slice = m_sliceTreeNode.Slice; bool isAtomic = slice.GetAtomicContext(out hvoDeleteOwner, out flidDelete); if (isAtomic || slice.GetSeqContext(out hvoDeleteOwner, out flidDelete, out ihvoDelete)) { if (ihvoDelete >= 0) { m_hvoDeleteTarget = m_cache.GetVectorItem(hvoDeleteOwner, flidDelete, ihvoDelete); } else { m_hvoDeleteTarget = m_cache.GetObjProperty(hvoDeleteOwner, flidDelete); } int clsid = m_cache.GetClassOfObject(m_hvoDeleteTarget); string targetClassName = m_cache.GetClassName((uint)clsid); string attrName = m_mdc.GetFieldName((uint)flidDelete); MenuItem item = new MenuItem(String.Format(DetailControlsStrings.ksItemFrom, new object[] { targetClassName, attrName }), new EventHandler(this.HandleDeleteMenuItem)); item.Enabled = OkToDelete(hvoDeleteOwner, flidDelete, isAtomic); mnuDelete.MenuItems.Add(item); } mnuDelete.Enabled = mnuDelete.MenuItems.Count > 0; }
/// <summary> /// NOTE: THis assumes that the PartOwnershipTree doesn't have multiple properties pointing to the /// same target class. This is an assumption that's likely to change in the future. /// </summary> /// <param name="targetClsId"></param> /// <returns></returns> public string GetSourceFieldName(int targetClsId) { string flidName; string targetClassName = m_cache.GetClassName((uint)targetClsId); XmlNode classNode = m_classOwnershipTree.SelectSingleNode(".//" + targetClassName); flidName = XmlUtils.GetManditoryAttributeValue(classNode, "sourceField"); return(flidName); }
private void AddMissingObjectLink() { if (m_sFormat == "xhtml") { return; } int iTopClass = m_rgClassNames.Count - 1; int iTopElem = m_rgElementTags.Count - 1; if (iTopClass < 0 || iTopElem < 0) { return; } string sClass = m_rgClassNames[iTopClass]; string sElement = m_rgElementTags[iTopElem]; if (sClass != sElement) { return; } if (!String.IsNullOrEmpty(sClass)) { return; } int hvo = CurrentObject(); if (hvo == 0) { return; } try { sClass = m_cache.GetClassName((uint)m_cache.GetClassOfObject(hvo)) + "Link"; string sOut = String.Format("<{0} target=\"hvo{1}\">", sClass, hvo); IndentLine(); m_writer.WriteLine(sOut); m_rgClassNames[iTopClass] = sClass; m_rgElementTags[iTopElem] = sClass; } catch { } }