Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/24/15 11:07:36 (10 years ago)
Author:
pfleck
Message:

#2025 Added a Priority for the CreatableAttribute to manually define an ordering for the NewItemDialog.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/NewItemDialog/HeuristicLab.Core/3.3/Attributes/CreatableAttribute.cs

    r12012 r12246  
    3636    }
    3737
     38    public int Priority { get; set; }
     39
     40
    3841    public CreatableAttribute() {
    3942      Category = "Other Items";
     43      Priority = int.MaxValue;
    4044    }
    4145    public CreatableAttribute(string category)
     
    5357      else return null;
    5458    }
     59
     60    public static int GetPriority(Type type) {
     61      var attribs = type.GetCustomAttributes(typeof(CreatableAttribute), false);
     62      if (attribs.Length > 0) return ((CreatableAttribute)attribs[0]).Priority;
     63      else return int.MaxValue;
     64    }
    5565  }
    5666}
Note: See TracChangeset for help on using the changeset viewer.