Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/30/11 14:59:16 (13 years ago)
Author:
mkommend
Message:

#1538: Added typeCondition in TypeSelector.Configure method to allow a more generic filtering of the returned types.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GP.Grammar.Editor/HeuristicLab.Core.Views/3.3/TypeSelector.cs

    r6019 r6335  
    8686
    8787    public virtual void Configure(Type baseType, bool showNotInstantiableTypes, bool showGenericTypes) {
    88       Configure(new List<Type>() { baseType }, showNotInstantiableTypes, showGenericTypes, true);
     88      Configure(baseType, showNotInstantiableTypes, showGenericTypes, (t) => { return true; });
     89    }
     90
     91    public virtual void Configure(Type baseType, bool showNotInstantiableTypes, bool showGenericTypes, Func<Type, bool> typeCondition) {
     92      Configure(new List<Type>() { baseType }, showNotInstantiableTypes, showGenericTypes, true, typeCondition);
    8993    }
    9094
    9195    public virtual void Configure(IEnumerable<Type> baseTypes, bool showNotInstantiableTypes, bool showGenericTypes, bool assignableToAllTypes) {
     96      Configure(baseTypes, showNotInstantiableTypes, showGenericTypes, assignableToAllTypes, (t) => { return true; });
     97    }
     98
     99    public virtual void Configure(IEnumerable<Type> baseTypes, bool showNotInstantiableTypes, bool showGenericTypes, bool assignableToAllTypes, Func<Type, bool> typeCondition) {
    92100      if (baseTypes == null) throw new ArgumentNullException();
    93101      if (InvokeRequired)
    94         Invoke(new Action<IEnumerable<Type>, bool, bool, bool>(Configure), baseTypes, showNotInstantiableTypes, showGenericTypes, assignableToAllTypes);
     102        Invoke(new Action<IEnumerable<Type>, bool, bool, bool, Func<Type, bool>>(Configure), baseTypes, showNotInstantiableTypes, showGenericTypes, assignableToAllTypes, typeCondition);
    95103      else {
    96104        this.baseTypes = baseTypes;
     
    120128
    121129          var types = from t in ApplicationManager.Manager.GetTypes(BaseTypes, plugin, !ShowNotInstantiableTypes, assignableToAllTypes)
     130                      where typeCondition(t)
    122131                      orderby t.Name ascending
    123132                      select t;
Note: See TracChangeset for help on using the changeset viewer.