Changeset 2992


Ignore:
Timestamp:
03/10/10 16:30:27 (12 years ago)
Author:
mkommend
Message:

overloaded GetViewTypes in MainFormManager(ticket #902)

Location:
trunk/sources
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.2/ViewContextMenuStrip.cs

    r2837 r2992  
    4141      if (this.item != null) {
    4242        ToolStripMenuItem menuItem;
    43         IEnumerable<Type> types = MainFormManager.GetViewTypes(item.GetType());
     43        IEnumerable<Type> types = MainFormManager.GetViewTypes(item.GetType(),true);
    4444        foreach (Type t in types) {
    4545          menuItem = new ToolStripMenuItem();
  • trunk/sources/HeuristicLab.MainForm/3.2/MainFormManager.cs

    r2810 r2992  
    8383      }
    8484      return viewTypes.Where(t => t != null);
     85    }
     86
     87    public static IEnumerable<Type> GetViewTypes(Type contentType, bool returnOnlyMostSpecificViewTypes) {
     88      List<Type> viewTypes = new List<Type>(GetViewTypes(contentType));
     89      if (returnOnlyMostSpecificViewTypes) {
     90        foreach (Type viewType in viewTypes.ToList()) {
     91          if(viewTypes.Any(t => t.IsSubclassOf(viewType)))
     92            viewTypes.Remove(viewType);
     93        }
     94      }
     95      return viewTypes;
    8596    }
    8697
Note: See TracChangeset for help on using the changeset viewer.