private ITsString MakeLabel(ListChoiceFilter filter) { string label; if (filter.Targets.Length == 1) { ITsString name; if (filter.Targets[0] == 0) { NullObjectLabel empty = new NullObjectLabel(); name = m_cache.MakeUserTss(empty.DisplayName); } else { ICmObject obj = CmObject.CreateFromDBObject(m_cache, filter.Targets[0]); name = obj.ShortNameTSS; } switch (filter.Mode) { case ListMatchOptions.None: { return ComposeLabel(name, XMLViewsStrings.ksNotX); } case ListMatchOptions.Exact: { return ComposeLabel(name, XMLViewsStrings.ksOnlyX); } default: // appropriate for both Any and All, which mean the same in this case. return name; } } else { switch (filter.Mode) { case ListMatchOptions.All: label = XMLViewsStrings.ksAllOf_; break; case ListMatchOptions.None: label = XMLViewsStrings.ksNoneOf_; break; case ListMatchOptions.Exact: label = XMLViewsStrings.ksOnly_; break; default: // typically Any label = XMLViewsStrings.ksAnyOf_; break; } return m_cache.MakeUserTss(label); } }
/// <summary> /// /// </summary> /// <param name="filter"></param> private void InvokeWithFilter(ListChoiceFilter filter) { filter.MakeUserVisible(true); // This fixes LT-6250. // Todo: do something about persisting and restoring the filter. // We can't call base.Invoke because it is designed for FilterBarCellFilters. m_combo.SelectedIndex = -1; // allows setting Tss to non-member. m_combo.Tss = MakeLabel(filter); m_fsi.Matcher = null; m_fsi.Filter = filter; //NOTE: it is necessary to change the filter after a change in the string m_combo.Tss // so that the heights of the comboBoxes in the Filterbar adjusted to accomodate the string. }