Line | |
---|
1 |
|
---|
2 | using System.Drawing;
|
---|
3 | using HeuristicLab.Clients.Hive.Jobs;
|
---|
4 | using HeuristicLab.Core;
|
---|
5 | using HeuristicLab.Optimization;
|
---|
6 | namespace HeuristicLab.Clients.Hive.Views.ExperimentManager.TreeView {
|
---|
7 | public class DeleteTaskTreeNodeAction : IItemTreeNodeAction<HiveTask> {
|
---|
8 | private ItemCollection<HiveTask> hiveTasks;
|
---|
9 |
|
---|
10 | public DeleteTaskTreeNodeAction(ItemCollection<HiveTask> hiveTasks) {
|
---|
11 | this.hiveTasks = hiveTasks;
|
---|
12 | }
|
---|
13 |
|
---|
14 | public string Name {
|
---|
15 | get { return "Delete Task"; }
|
---|
16 | }
|
---|
17 |
|
---|
18 | public Image Image {
|
---|
19 | get { return null; }
|
---|
20 | }
|
---|
21 |
|
---|
22 | public void Execute(HiveTask item, HiveTask parentItem) {
|
---|
23 | if (parentItem == null) {
|
---|
24 | hiveTasks.Remove(item);
|
---|
25 | } else {
|
---|
26 | var experiment = parentItem.ItemTask.Item as Experiment;
|
---|
27 | if (experiment != null) {
|
---|
28 | experiment.Optimizers.Remove(((OptimizerTask)item.ItemTask).Item);
|
---|
29 | }
|
---|
30 | }
|
---|
31 | }
|
---|
32 | }
|
---|
33 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.