private IPhFeatureConstraint RemoveFeatureConstraint(ILcmReferenceSequence <IPhFeatureConstraint> featConstrs, IFsFeatDefn feat) { var constrToRemove = GetFeatureConstraint(featConstrs, feat); if (constrToRemove != null) { featConstrs.Remove(constrToRemove); } return(constrToRemove); }
int GetVariablesWidth(IPhSimpleContextNC ctxt, IVwEnv vwenv, bool polarity) { ILcmReferenceSequence <IPhFeatureConstraint> vars = polarity ? ctxt.PlusConstrRS : ctxt.MinusConstrRS; int maxLen = 0; foreach (IPhFeatureConstraint var in vars) { ITsString varLine = CreateVariableLine(var, polarity); int len = GetStrWidth(varLine, null, vwenv); if (len > maxLen) { maxLen = len; } } return(maxLen); }
/// <summary> /// Remove either the given entry or any sense owned by that entry from the list. /// </summary> private static void RemoveEntryFromList(ILcmReferenceSequence <ICmObject> list, ILexEntry entry) { var objsToRemove = new List <ICmObject>(); foreach (var item in list) { if ((item as ILexEntry) == entry) { objsToRemove.Add(item); } else if (item is ILexSense && item.OwnerOfClass <ILexEntry>() == entry) { objsToRemove.Add(item); } } foreach (var item in objsToRemove) { list.Remove(item); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Gets the sequence of selected possibilities /// </summary> /// <param name="listToUpdate">Sequence of possibilities. All possibilities that may be in /// this list get deleted and the new ones added.</param> /// <returns>True if the sequence was changed, false otherwise</returns> /// ------------------------------------------------------------------------------------ public bool GetPossibilities(ILcmReferenceSequence <ICmPossibility> listToUpdate) { CheckDisposed(); Debug.Assert(listToUpdate != null); Guid[] origGuids = listToUpdate.ToGuidArray(); // Clear the list first. listToUpdate.Clear(); bool fAllItemsAreTheSame = true; int i = 0; foreach (ICmPossibility newPoss in tvPossibilities.SelectedPossibilities) { listToUpdate.Add(newPoss); fAllItemsAreTheSame &= (i < origGuids.Length && origGuids[i++] != newPoss.Guid); } return(!fAllItemsAreTheSame || i != origGuids.Length); }