/// <summary> /// determine whether the object should be included in the output /// </summary> /// <param name="obj">the object in question</param> /// <param name="filterReason">any explanation of why the object should not be included</param> /// <returns>true if the object should be included in the output</returns> public bool DoInclude (ICmObject obj, out string filterReason) { ConstraintFailure failure; //discussion: should we were first check can to see if there are already errors? // pro: it would be faster on the relatively few objects that already have error annotations // con: it would allow a error which is no longer true to live on, causing problems // decision: just go ahead in check them every time. if (!obj.CheckConstraints(0, false, out failure)) { filterReason = failure.GetMessage(); return false; } filterReason=null; return true; }
/// <summary> /// determine whether the object should be included in the output /// </summary> /// <param name="obj">the object in question</param> /// <param name="filterReason">any explanation of why the object should not be included</param> /// <returns>true if the object should be included in the output</returns> public bool DoInclude(ICmObject obj, out string filterReason) { ConstraintFailure failure; //discussion: should we were first check can to see if there are already errors? // pro: it would be faster on the relatively few objects that already have error annotations // con: it would allow a error which is no longer true to live on, causing problems // decision: just go ahead in check them every time. if (!obj.CheckConstraints(0, false, out failure)) { filterReason = failure.GetMessage(); return(false); } filterReason = null; return(true); }
private void DoValidation() { // This may be called in the process of deleting the object after the object // has been partially cleared out and thus would certainly fail the constraint // check, then try to instantiate an error annotation which wouldn't have an // owner, causing bad things to happen. if (m_obj != null && m_obj.IsValidObject) { ConstraintFailure failure; if (m_obj is IPhEnvironment) { (m_obj as IPhEnvironment).CheckConstraints(m_flid, true, out failure, /* adjust squiggly line */ true); } else { m_obj.CheckConstraints(m_flid, true, out failure); } } }