1 | using System.Windows.Forms;
|
---|
2 | using HeuristicLab.Collections;
|
---|
3 | using HeuristicLab.MainForm;
|
---|
4 |
|
---|
5 | namespace HeuristicLab.Core.Views {
|
---|
6 | [Content(typeof(OperatorList), true)]
|
---|
7 | [Content(typeof(IObservableList<IOperator>), false)]
|
---|
8 | public partial class OperatorListView : ItemListView<IOperator> {
|
---|
9 | protected TypeSelectorDialog typeSelectorDialog;
|
---|
10 |
|
---|
11 | /// <summary>
|
---|
12 | /// Initializes a new instance of <see cref="VariablesScopeView"/> with caption "Variables Scope View".
|
---|
13 | /// </summary>
|
---|
14 | public OperatorListView() {
|
---|
15 | InitializeComponent();
|
---|
16 | Caption = "Operator List";
|
---|
17 | itemsGroupBox.Text = "&Operators";
|
---|
18 | }
|
---|
19 | /// <summary>
|
---|
20 | /// Initializes a new instance of <see cref="VariablesScopeView"/> with
|
---|
21 | /// the given <paramref name="scope"/>.
|
---|
22 | /// </summary>
|
---|
23 | /// <remarks>Calls <see cref="VariablesScopeView()"/>.</remarks>
|
---|
24 | /// <param name="scope">The scope whose variables should be represented visually.</param>
|
---|
25 | public OperatorListView(IObservableList<IOperator> content)
|
---|
26 | : this() {
|
---|
27 | Content = content;
|
---|
28 | }
|
---|
29 |
|
---|
30 | protected override IOperator CreateItem() {
|
---|
31 | if (typeSelectorDialog == null) {
|
---|
32 | typeSelectorDialog = new TypeSelectorDialog();
|
---|
33 | typeSelectorDialog.TypeSelector.Caption = "&Available Operators";
|
---|
34 | typeSelectorDialog.TypeSelector.Configure(typeof(IOperator), false, false);
|
---|
35 | }
|
---|
36 |
|
---|
37 | if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK)
|
---|
38 | return (IOperator)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType();
|
---|
39 | else
|
---|
40 | return null;
|
---|
41 | }
|
---|
42 | }
|
---|
43 | }
|
---|