Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/28/11 19:12:31 (13 years ago)
Author:
mkommend
Message:

#1454: Implemented TypeDiscovery with multiple base types and adapted TypeSelector and CrossValidation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core.Views/3.3/TypeSelector.cs

    r5848 r5850  
    3535    protected TypeSelectorDialog typeSelectorDialog;
    3636
    37     protected Type baseType;
    38     public Type BaseType {
    39       get { return baseType; }
     37    protected IEnumerable<Type> baseTypes;
     38    public IEnumerable<Type> BaseTypes {
     39      get { return baseTypes; }
    4040    }
    4141    protected bool showNotInstantiableTypes;
     
    8686
    8787    public virtual void Configure(Type baseType, bool showNotInstantiableTypes, bool showGenericTypes) {
    88       if (baseType == null) throw new ArgumentNullException();
     88      Configure(new List<Type>() { baseType }, showNotInstantiableTypes, showGenericTypes);
     89    }
     90
     91    public virtual void Configure(IEnumerable<Type> baseTypes, bool showNotInstantiableTypes, bool showGenericTypes) {
     92      if (baseTypes == null) throw new ArgumentNullException();
    8993      if (InvokeRequired)
    90         Invoke(new Action<Type, bool, bool>(Configure), baseType, showNotInstantiableTypes, showGenericTypes);
     94        Invoke(new Action<IEnumerable<Type>, bool, bool>(Configure), baseTypes, showNotInstantiableTypes, showGenericTypes);
    9195      else {
    92         this.baseType = baseType;
     96        this.baseTypes = baseTypes;
    9397        this.showNotInstantiableTypes = showNotInstantiableTypes;
    9498        this.showGenericTypes = showGenericTypes;
     
    115119          pluginNode.Tag = plugin;
    116120
    117           var types = from t in ApplicationManager.Manager.GetTypes(BaseType, plugin, ShowNotInstantiableTypes)
     121          var types = from t in ApplicationManager.Manager.GetTypes(BaseTypes, plugin, ShowNotInstantiableTypes)
    118122                      orderby t.Name ascending
    119123                      select t;
     
    252256      }
    253257      Type param = typeParametersListView.SelectedItems[0].Tag as Type;
    254       Type[] contraints = param.GetGenericParameterConstraints();
     258      Type[] constraints = param.GetGenericParameterConstraints();
    255259      bool showNotInstantiableTypes = !param.GenericParameterAttributes.HasFlag(GenericParameterAttributes.DefaultConstructorConstraint);
    256       typeSelectorDialog.TypeSelector.Configure(typeof(IItem), showNotInstantiableTypes, true);
     260      typeSelectorDialog.TypeSelector.Configure(constraints, showNotInstantiableTypes, true);
    257261
    258262      if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) {
Note: See TracChangeset for help on using the changeset viewer.