using System.Drawing; using HeuristicLab.Clients.Hive.Jobs; using HeuristicLab.Core; using HeuristicLab.Optimization; namespace HeuristicLab.Clients.Hive.Views.ExperimentManager.TreeView { public class DeleteJobTreeNodeAction : IItemTreeNodeAction { private ItemCollection hiveJobs; public DeleteJobTreeNodeAction(ItemCollection hiveJobs) { this.hiveJobs = hiveJobs; } public string Name { get { return "Delete Job"; } } public Image Image { get { return null; } } public void Execute(HiveJob item, HiveJob parentItem) { if (parentItem == null) { hiveJobs.Remove(item); } else { var experiment = parentItem.ItemJob.Item as Experiment; if (experiment != null) { experiment.Optimizers.Remove(((OptimizerJob)item.ItemJob).Item); } } } } }