/// <summary> /// Override method to handle launching of a chooser for selecting lexical entries. /// </summary> protected override void HandleChooser() { ILexRefType lrt = LexRefType.CreateFromDBObject(m_cache, m_obj.OwnerHVO); LexRefType.MappingTypes type = (LexRefType.MappingTypes)lrt.MappingType; BaseGoDlg dlg = null; switch (type) { case LexRefType.MappingTypes.kmtSensePair: case LexRefType.MappingTypes.kmtSenseAsymmetricPair: // Sense pair with different Forward/Reverse names dlg = new LinkEntryOrSenseDlg(); (dlg as LinkEntryOrSenseDlg).SelectSensesOnly = true; break; case LexRefType.MappingTypes.kmtEntryPair: case LexRefType.MappingTypes.kmtEntryAsymmetricPair: // Entry pair with different Forward/Reverse names dlg = new GoDlg(); break; case LexRefType.MappingTypes.kmtEntryOrSensePair: case LexRefType.MappingTypes.kmtEntryOrSenseAsymmetricPair: // Entry or sense pair with different Forward/Reverse dlg = new LinkEntryOrSenseDlg(); (dlg as LinkEntryOrSenseDlg).SelectSensesOnly = false; break; } Debug.Assert(dlg != null); WindowParams wp = new WindowParams(); //on creating Pair Lexical Relation have an Add button and Add in the title bar if (TargetHvo == 0) { wp.m_title = String.Format(LexEdStrings.ksIdentifyXEntry, lrt.Name.AnalysisDefaultWritingSystem); wp.m_btnText = LexEdStrings.ks_Add; } else //Otherwise we are Replacing the item { wp.m_title = String.Format(LexEdStrings.ksReplaceXEntry); wp.m_btnText = LexEdStrings.ks_Replace; } wp.m_label = LexEdStrings.ksFind_; dlg.SetDlgInfo(m_cache, wp, m_mediator); dlg.SetHelpTopic("khtpChooseLexicalRelationAdd"); if (dlg.ShowDialog(FindForm()) == DialogResult.OK) { TargetHvo = dlg.SelectedID; } dlg.Dispose(); }
/// <summary> /// Override method to handle launching of a chooser for selecting lexical entries. /// </summary> protected override void HandleChooser() { var lrt = (ILexRefType)m_obj.Owner; var type = (LexRefTypeTags.MappingTypes)lrt.MappingType; BaseGoDlg dlg = null; string sTitle = string.Empty; try { switch (type) { case LexRefTypeTags.MappingTypes.kmtSenseCollection: dlg = new LinkEntryOrSenseDlg(); (dlg as LinkEntryOrSenseDlg).SelectSensesOnly = true; sTitle = String.Format(LexEdStrings.ksIdentifyXSense, lrt.Name.BestAnalysisAlternative.Text); break; case LexRefTypeTags.MappingTypes.kmtEntryCollection: dlg = new EntryGoDlg(); sTitle = String.Format(LexEdStrings.ksIdentifyXLexEntry, lrt.Name.BestAnalysisAlternative.Text); break; case LexRefTypeTags.MappingTypes.kmtEntryOrSenseCollection: dlg = new LinkEntryOrSenseDlg(); sTitle = String.Format(LexEdStrings.ksIdentifyXLexEntryOrSense, lrt.Name.BestAnalysisAlternative.Text); break; } Debug.Assert(dlg != null); var wp = new WindowParams { m_title = sTitle, m_btnText = LexEdStrings.ks_Add }; dlg.SetDlgInfo(m_cache, wp, m_mediator); dlg.SetHelpTopic("khtpChooseLexicalRelationAdd"); if (dlg.ShowDialog(FindForm()) == DialogResult.OK && dlg.SelectedObject != null) { if (!((ILexReference)m_obj).TargetsRS.Contains(dlg.SelectedObject)) { AddItem(dlg.SelectedObject); } } } finally { if (dlg != null) { dlg.Dispose(); } } }
/// <summary> /// This method is called when we are creating a new lexical relation slice. /// If the user selects an item it's hvo is returned. /// Otherwise 0 is returned and the lexical relation should not be created. /// </summary> /// <param name="lrt"></param> /// <returns></returns> private ICmObject GetRootObject(ILexRefType lrt) { ICmObject first = null; EntryGoDlg dlg = null; try { switch ((LexRefTypeTags.MappingTypes)lrt.MappingType) { case LexRefTypeTags.MappingTypes.kmtSenseAsymmetricPair: case LexRefTypeTags.MappingTypes.kmtSenseTree: dlg = new LinkEntryOrSenseDlg(); (dlg as LinkEntryOrSenseDlg).SelectSensesOnly = true; break; case LexRefTypeTags.MappingTypes.kmtEntryAsymmetricPair: case LexRefTypeTags.MappingTypes.kmtEntryTree: dlg = new EntryGoDlg(); break; case LexRefTypeTags.MappingTypes.kmtEntryOrSenseAsymmetricPair: case LexRefTypeTags.MappingTypes.kmtEntryOrSenseTree: dlg = new LinkEntryOrSenseDlg(); break; default: Debug.Assert(lrt.MappingType == (int)LexRefTypeTags.MappingTypes.kmtSenseAsymmetricPair || lrt.MappingType == (int)LexRefTypeTags.MappingTypes.kmtSenseTree); return(null); } Debug.Assert(dlg != null); var wp = new WindowParams { m_title = String.Format(LexEdStrings.ksIdentifyXEntry, lrt.ReverseName.BestAnalysisAlternative.Text), m_btnText = LexEdStrings.ks_Add }; dlg.SetDlgInfo(m_cache, wp, Mediator); dlg.SetHelpTopic("khtpChooseLexicalRelationAdd"); if (dlg.ShowDialog(FindForm()) == DialogResult.OK) { first = dlg.SelectedObject; } return(first); } finally { if (dlg != null) { dlg.Dispose(); } } }
/// <summary> /// Override method to handle launching of a chooser for selecting lexical entries. /// </summary> protected override void HandleChooser() { ILexRefType lrt = (ILexRefType)m_obj.Owner; int type = lrt.MappingType; BaseGoDlg dlg = null; try { switch ((LexRefTypeTags.MappingTypes)type) { case LexRefTypeTags.MappingTypes.kmtSenseTree: dlg = new LinkEntryOrSenseDlg(); (dlg as LinkEntryOrSenseDlg).SelectSensesOnly = true; break; case LexRefTypeTags.MappingTypes.kmtEntryTree: dlg = new EntryGoDlg(); break; case LexRefTypeTags.MappingTypes.kmtEntryOrSenseTree: dlg = new LinkEntryOrSenseDlg(); break; } Debug.Assert(dlg != null); var wp = new WindowParams { m_title = String.Format(LexEdStrings.ksReplaceXEntry), m_btnText = LexEdStrings.ks_Replace }; //This method is only called when we are Replacing the //tree root of a Whole/Part lexical relation dlg.SetDlgInfo(m_cache, wp, m_mediator); dlg.SetHelpTopic("khtpChooseLexicalRelationAdd"); if (dlg.ShowDialog(FindForm()) == DialogResult.OK) { if (dlg.SelectedObject != null) { AddItem(dlg.SelectedObject); } } } finally { if (dlg != null) { dlg.Dispose(); } } }
/// <summary> /// This method is called when we are creating a new lexical relation slice. /// If the user selects an item it's hvo is returned. /// Otherwise 0 is returned and the lexical relation should not be created. /// </summary> /// <param name="lrt"></param> /// <returns></returns> private int GetRootObjectHvo(ILexRefType lrt) { int hvoFirst = 0; BaseEntryGoDlg dlg = null; switch ((LexRefType.MappingTypes)lrt.MappingType) { case LexRefType.MappingTypes.kmtSenseAsymmetricPair: case LexRefType.MappingTypes.kmtSenseTree: dlg = new LinkEntryOrSenseDlg(); (dlg as LinkEntryOrSenseDlg).SelectSensesOnly = true; break; case LexRefType.MappingTypes.kmtEntryAsymmetricPair: case LexRefType.MappingTypes.kmtEntryTree: dlg = new GoDlg(); break; case LexRefType.MappingTypes.kmtEntryOrSenseAsymmetricPair: case LexRefType.MappingTypes.kmtEntryOrSenseTree: dlg = new LinkEntryOrSenseDlg(); break; default: Debug.Assert(lrt.MappingType == (int)LexRefType.MappingTypes.kmtSenseAsymmetricPair || lrt.MappingType == (int)LexRefType.MappingTypes.kmtSenseTree); return(0); } Debug.Assert(dlg != null); WindowParams wp = new WindowParams(); //wp.m_title = String.Format(LexEdStrings.ksIdentifyXEntry, // lrt.Name.AnalysisDefaultWritingSystem); wp.m_title = String.Format(LexEdStrings.ksIdentifyXEntry, lrt.ReverseName.BestAnalysisAlternative.Text); wp.m_label = LexEdStrings.ksFind_; //wp.m_btnText = LexEdStrings.ks_Link; wp.m_btnText = LexEdStrings.ks_Add; dlg.SetDlgInfo(m_cache, wp, Mediator); dlg.SetHelpTopic("khtpChooseLexicalRelationAdd"); if (dlg.ShowDialog(FindForm()) == DialogResult.OK) { hvoFirst = dlg.SelectedID; } dlg.Dispose(); return(hvoFirst); }
/// <summary> /// Override method to handle launching of a chooser for selecting lexical entries. /// </summary> protected override void HandleChooser() { ILexRefType lrt = LexRefType.CreateFromDBObject(m_cache, m_obj.OwnerHVO); LexRefType.MappingTypes type = (LexRefType.MappingTypes)lrt.MappingType; BaseGoDlg dlg = null; string sTitle = ""; switch (type) { case LexRefType.MappingTypes.kmtSenseCollection: dlg = new LinkEntryOrSenseDlg(); (dlg as LinkEntryOrSenseDlg).SelectSensesOnly = true; sTitle = String.Format(LexEdStrings.ksIdentifyXSense, lrt.Name.BestAnalysisAlternative.Text); break; case LexRefType.MappingTypes.kmtEntryCollection: dlg = new GoDlg(); sTitle = String.Format(LexEdStrings.ksIdentifyXLexEntry, lrt.Name.BestAnalysisAlternative.Text); break; case LexRefType.MappingTypes.kmtEntryOrSenseCollection: dlg = new LinkEntryOrSenseDlg(); sTitle = String.Format(LexEdStrings.ksIdentifyXLexEntryOrSense, lrt.Name.BestAnalysisAlternative.Text); break; } Debug.Assert(dlg != null); WindowParams wp = new WindowParams(); wp.m_title = sTitle; wp.m_label = LexEdStrings.ksFind_; wp.m_btnText = LexEdStrings.ks_Add; //for collection relation of items always have an Add button dlg.SetDlgInfo(m_cache, wp, m_mediator); dlg.SetHelpTopic("khtpChooseLexicalRelationAdd"); if (dlg.ShowDialog(FindForm()) == DialogResult.OK) { AddItem(dlg.SelectedID); } dlg.Dispose(); }
/// <summary> /// Override method to handle launching of a chooser for selecting lexical entries. /// </summary> protected override void HandleChooser() { ILexRefType lrt = LexRefType.CreateFromDBObject(m_cache, m_obj.OwnerHVO); int type = lrt.MappingType; BaseGoDlg dlg = null; switch ((LexRefType.MappingTypes)type) { case LexRefType.MappingTypes.kmtSenseTree: dlg = new LinkEntryOrSenseDlg(); (dlg as LinkEntryOrSenseDlg).SelectSensesOnly = true; break; case LexRefType.MappingTypes.kmtEntryTree: dlg = new GoDlg(); break; case LexRefType.MappingTypes.kmtEntryOrSenseTree: dlg = new LinkEntryOrSenseDlg(); break; } Debug.Assert(dlg != null); WindowParams wp = new WindowParams(); //This method is only called when we are Replacing the //tree root of a Whole/Part lexical relation wp.m_title = String.Format(LexEdStrings.ksReplaceXEntry); wp.m_btnText = LexEdStrings.ks_Replace; wp.m_label = LexEdStrings.ksFind_; dlg.SetDlgInfo(m_cache, wp, m_mediator); dlg.SetHelpTopic("khtpChooseLexicalRelationAdd"); if (dlg.ShowDialog(FindForm()) == DialogResult.OK) { TargetHvo = dlg.SelectedID; } dlg.Dispose(); }
/// <summary> /// Override method to handle launching of a chooser for selecting lexical entries. /// </summary> protected override void HandleChooser() { ILexRefType lrt = LexRefType.CreateFromDBObject(m_cache, m_obj.OwnerHVO); int type = lrt.MappingType; BaseGoDlg dlg = null; switch ((LexRefType.MappingTypes)type) { case LexRefType.MappingTypes.kmtSenseTree: dlg = new LinkEntryOrSenseDlg(); (dlg as LinkEntryOrSenseDlg).SelectSensesOnly = true; break; case LexRefType.MappingTypes.kmtEntryTree: dlg = new GoDlg(); break; case LexRefType.MappingTypes.kmtEntryOrSenseTree: dlg = new LinkEntryOrSenseDlg(); break; } Debug.Assert(dlg != null); WindowParams wp = new WindowParams(); wp.m_title = String.Format(LexEdStrings.ksIdentifyXEntry, lrt.Name.AnalysisDefaultWritingSystem); wp.m_label = LexEdStrings.ksFind_; wp.m_btnText = LexEdStrings.ks_Add; //for parts of a whole always have an Add button dlg.SetDlgInfo(m_cache, wp, m_mediator); dlg.SetHelpTopic("khtpChooseLexicalRelationAdd"); if (dlg.ShowDialog(FindForm()) == DialogResult.OK) { AddItem(dlg.SelectedID); } dlg.Dispose(); }
/// <summary> /// This method is called when we are creating a new lexical relation slice. /// If the user selects an item it's hvo is returned. /// Otherwise 0 is returned and the lexical relation should not be created. /// </summary> /// <param name="lrt"></param> /// <returns></returns> private ICmObject GetChildObject(ILexRefType lrt) { ICmObject first = null; EntryGoDlg dlg = null; string sTitle = string.Empty; try { switch ((LexRefTypeTags.MappingTypes)lrt.MappingType) { case LexRefTypeTags.MappingTypes.kmtEntryOrSensePair: case LexRefTypeTags.MappingTypes.kmtEntryOrSenseAsymmetricPair: // Entry or sense pair with different Forward/Reverse dlg = new LinkEntryOrSenseDlg(); (dlg as LinkEntryOrSenseDlg).SelectSensesOnly = false; sTitle = String.Format(LexEdStrings.ksIdentifyXLexEntryOrSense, lrt.Name.BestAnalysisAlternative.Text); break; case LexRefTypeTags.MappingTypes.kmtSenseCollection: case LexRefTypeTags.MappingTypes.kmtSensePair: case LexRefTypeTags.MappingTypes.kmtSenseAsymmetricPair: case LexRefTypeTags.MappingTypes.kmtSenseUnidirectional: // Sense pair with different Forward/Reverse names case LexRefTypeTags.MappingTypes.kmtSenseSequence: case LexRefTypeTags.MappingTypes.kmtSenseTree: dlg = new LinkEntryOrSenseDlg(); (dlg as LinkEntryOrSenseDlg).SelectSensesOnly = true; sTitle = String.Format(LexEdStrings.ksIdentifyXSense, lrt.Name.BestAnalysisAlternative.Text); break; case LexRefTypeTags.MappingTypes.kmtEntryCollection: case LexRefTypeTags.MappingTypes.kmtEntryPair: case LexRefTypeTags.MappingTypes.kmtEntryAsymmetricPair: case LexRefTypeTags.MappingTypes.kmtEntryUnidirectional: // Entry pair with different Forward/Reverse names case LexRefTypeTags.MappingTypes.kmtEntrySequence: case LexRefTypeTags.MappingTypes.kmtEntryTree: dlg = new EntryGoDlg(); sTitle = String.Format(LexEdStrings.ksIdentifyXLexEntry, lrt.Name.BestAnalysisAlternative.Text); break; case LexRefTypeTags.MappingTypes.kmtEntryOrSenseCollection: case LexRefTypeTags.MappingTypes.kmtEntryOrSenseSequence: case LexRefTypeTags.MappingTypes.kmtEntryOrSenseTree: case LexRefTypeTags.MappingTypes.kmtEntryOrSenseUnidirectional: dlg = new LinkEntryOrSenseDlg(); sTitle = String.Format(LexEdStrings.ksIdentifyXLexEntryOrSense, lrt.Name.BestAnalysisAlternative.Text); break; default: Debug.Assert(lrt.MappingType == (int)LexRefTypeTags.MappingTypes.kmtSenseAsymmetricPair || lrt.MappingType == (int)LexRefTypeTags.MappingTypes.kmtSenseTree); return(null); } Debug.Assert(dlg != null); var wp = new WindowParams { m_title = sTitle, m_btnText = LexEdStrings.ks_Add }; // Don't display the current entry in the list of matching entries. See LT-2611. ICmObject objEntry = this.Object; while (objEntry.ClassID == LexSenseTags.kClassId) { objEntry = objEntry.Owner; } Debug.Assert(objEntry.ClassID == LexEntryTags.kClassId); dlg.StartingEntry = objEntry as ILexEntry; dlg.SetDlgInfo(m_cache, wp, Mediator); dlg.SetHelpTopic("khtpChooseLexicalRelationAdd"); if (dlg.ShowDialog(FindForm()) == DialogResult.OK) { first = dlg.SelectedObject; } return(first); } finally { if (dlg != null) { dlg.Dispose(); } } }
/// <summary> /// Override method to handle launching of a chooser for selecting lexical entries. /// </summary> protected override void HandleChooser() { ILexRefType lrt = (ILexRefType)m_obj.Owner; LexRefTypeTags.MappingTypes type = (LexRefTypeTags.MappingTypes)lrt.MappingType; BaseGoDlg dlg = null; try { switch (type) { case LexRefTypeTags.MappingTypes.kmtSensePair: case LexRefTypeTags.MappingTypes.kmtSenseAsymmetricPair: // Sense pair with different Forward/Reverse names dlg = new LinkEntryOrSenseDlg(); (dlg as LinkEntryOrSenseDlg).SelectSensesOnly = true; break; case LexRefTypeTags.MappingTypes.kmtEntryPair: case LexRefTypeTags.MappingTypes.kmtEntryAsymmetricPair: // Entry pair with different Forward/Reverse names dlg = new EntryGoDlg(); break; case LexRefTypeTags.MappingTypes.kmtEntryOrSensePair: case LexRefTypeTags.MappingTypes.kmtEntryOrSenseAsymmetricPair: // Entry or sense pair with different Forward/Reverse dlg = new LinkEntryOrSenseDlg(); (dlg as LinkEntryOrSenseDlg).SelectSensesOnly = false; break; } Debug.Assert(dlg != null); var wp = new WindowParams(); //on creating Pair Lexical Relation have an Add button and Add in the title bar if (Target == null) { wp.m_title = String.Format(LexEdStrings.ksIdentifyXEntry, lrt.Name.BestAnalysisAlternative.Text); wp.m_btnText = LexEdStrings.ks_Add; } else //Otherwise we are Replacing the item { wp.m_title = String.Format(LexEdStrings.ksReplaceXEntry); wp.m_btnText = LexEdStrings.ks_Replace; } dlg.SetDlgInfo(m_cache, wp, m_mediator); dlg.SetHelpTopic("khtpChooseLexicalRelationAdd"); if (dlg.ShowDialog(FindForm()) == DialogResult.OK) { if (dlg.SelectedObject != null) { AddItem(dlg.SelectedObject); // it is possible that the previous update has caused the data tree to refresh if (!IsDisposed) { m_atomicRefView.RootBox.Reconstruct(); // view is somehow too complex for auto-update. } } } } finally { if (dlg != null) { dlg.Dispose(); } } }
/// <summary> /// This method is called when we are creating a new lexical relation slice. /// If the user selects an item it's hvo is returned. /// Otherwise 0 is returned and the lexical relation should not be created. /// </summary> /// <param name="lrt"></param> /// <returns></returns> private int GetChildObjectHvo(ILexRefType lrt) { int hvoFirst = 0; BaseEntryGoDlg dlg = null; string sTitle = ""; switch ((LexRefType.MappingTypes)lrt.MappingType) { case LexRefType.MappingTypes.kmtEntryOrSensePair: case LexRefType.MappingTypes.kmtEntryOrSenseAsymmetricPair: // Entry or sense pair with different Forward/Reverse dlg = new LinkEntryOrSenseDlg(); (dlg as LinkEntryOrSenseDlg).SelectSensesOnly = false; sTitle = String.Format(LexEdStrings.ksIdentifyXLexEntryOrSense, lrt.Name.BestAnalysisAlternative.Text); break; case LexRefType.MappingTypes.kmtSenseCollection: case LexRefType.MappingTypes.kmtSensePair: case LexRefType.MappingTypes.kmtSenseAsymmetricPair: // Sense pair with different Forward/Reverse names case LexRefType.MappingTypes.kmtSenseSequence: case LexRefType.MappingTypes.kmtSenseTree: dlg = new LinkEntryOrSenseDlg(); (dlg as LinkEntryOrSenseDlg).SelectSensesOnly = true; sTitle = String.Format(LexEdStrings.ksIdentifyXSense, lrt.Name.BestAnalysisAlternative.Text); break; case LexRefType.MappingTypes.kmtEntryCollection: case LexRefType.MappingTypes.kmtEntryPair: case LexRefType.MappingTypes.kmtEntryAsymmetricPair: // Entry pair with different Forward/Reverse names case LexRefType.MappingTypes.kmtEntrySequence: case LexRefType.MappingTypes.kmtEntryTree: dlg = new GoDlg(); sTitle = String.Format(LexEdStrings.ksIdentifyXLexEntry, lrt.Name.BestAnalysisAlternative.Text); break; case LexRefType.MappingTypes.kmtEntryOrSenseCollection: case LexRefType.MappingTypes.kmtEntryOrSenseSequence: case LexRefType.MappingTypes.kmtEntryOrSenseTree: dlg = new LinkEntryOrSenseDlg(); sTitle = String.Format(LexEdStrings.ksIdentifyXLexEntryOrSense, lrt.Name.BestAnalysisAlternative.Text); break; default: Debug.Assert(lrt.MappingType == (int)LexRefType.MappingTypes.kmtSenseAsymmetricPair || lrt.MappingType == (int)LexRefType.MappingTypes.kmtSenseTree); return(0); } Debug.Assert(dlg != null); WindowParams wp = new WindowParams(); wp.m_title = sTitle; wp.m_label = LexEdStrings.ksFind_; wp.m_btnText = LexEdStrings.ks_Add; // Don't display the current entry in the list of matching entries. See LT-2611. ICmObject objEntry = this.Object; while (objEntry.ClassID == LexSense.kclsidLexSense) { objEntry = CmObject.CreateFromDBObject(m_cache, objEntry.OwnerHVO); } Debug.Assert(objEntry.ClassID == LexEntry.kclsidLexEntry); dlg.StartingEntry = objEntry as ILexEntry; dlg.SetDlgInfo(m_cache, wp, Mediator); dlg.SetHelpTopic("khtpChooseLexicalRelationAdd"); if (dlg.ShowDialog(FindForm()) == DialogResult.OK) { hvoFirst = dlg.SelectedID; } dlg.Dispose(); return(hvoFirst); }