Index: branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/ExtensionMethods/TreeNodeExtensions.cs
===================================================================
--- branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/ExtensionMethods/TreeNodeExtensions.cs	(revision 11203)
+++ branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/ExtensionMethods/TreeNodeExtensions.cs	(revision 11204)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/HeuristicLab.Clients.Hive.JobManager-3.3.csproj
===================================================================
--- branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/HeuristicLab.Clients.Hive.JobManager-3.3.csproj	(revision 11203)
+++ branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/HeuristicLab.Clients.Hive.JobManager-3.3.csproj	(revision 11204)
@@ -98,4 +98,6 @@
     <Compile Include="ExtensionMethods\TreeNodeExtensions.cs" />
     <Compile Include="ListViewItemDateComparer.cs" />
+    <Compile Include="MenuItems\CreateHiveJobMenuItem.cs" />
+    <Compile Include="MenuItems\RunInHiveMenuItem.cs" />
     <Compile Include="Plugin.cs" />
     <Compile Include="Views\HiveJobManagerView.cs">
Index: branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/ListViewItemDateComparer.cs
===================================================================
--- branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/ListViewItemDateComparer.cs	(revision 11203)
+++ branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/ListViewItemDateComparer.cs	(revision 11204)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -31,14 +31,14 @@
   public class ListViewItemDateComparer : IComparer {
     private int col;
-    private SortOrder order;
+    public SortOrder Order { get; set; }
 
     public ListViewItemDateComparer() {
       col = 0;
-      order = SortOrder.Ascending;
+      Order = SortOrder.Ascending;
     }
 
     public ListViewItemDateComparer(int column, SortOrder order) {
       col = column;
-      this.order = order;
+      Order = order;
     }
 
@@ -66,5 +66,5 @@
       }
 
-      if (order == SortOrder.Descending) {
+      if (Order == SortOrder.Descending) {
         // invert the value returned by Compare.
         returnVal *= -1;
Index: branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/MenuItems/CreateHiveJobMenuItem.cs
===================================================================
--- branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/MenuItems/CreateHiveJobMenuItem.cs	(revision 11204)
+++ branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/MenuItems/CreateHiveJobMenuItem.cs	(revision 11204)
@@ -0,0 +1,83 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using HeuristicLab.Core;
+using HeuristicLab.MainForm;
+using HeuristicLab.Optimization;
+using HeuristicLab.Optimizer;
+
+namespace HeuristicLab.Clients.Hive.JobManager {
+  public class CreateHiveJobMenuItem : HeuristicLab.MainForm.WindowsForms.MenuItem, IOptimizerUserInterfaceItemProvider {
+    public override string Name {
+      get { return "&Create Hive Job"; }
+    }
+    public override IEnumerable<string> Structure {
+      get { return new string[] { "&Services", "&Hive" }; }
+    }
+
+    public override int Position {
+      get { return 10001; }
+    }
+
+    protected override void OnActiveViewChanged(object sender, EventArgs e) {
+      IContentView activeView = MainFormManager.MainForm.ActiveView as IContentView;
+
+      if (activeView != null && activeView.Content != null && !activeView.Locked) {
+        var content = activeView.Content as IItem;
+        if (content != null) {
+          Type contentType = content.GetType();
+          ToolStripItem.Enabled = ItemTask.IsTypeSupported(contentType);
+          return;
+        }
+      }
+      ToolStripItem.Enabled = false;
+    }
+
+    public override void Execute() {
+      IContentView activeView = MainFormManager.MainForm.ActiveView as IContentView;
+      var content = activeView.Content as IItem;
+
+      //IOptimizer and IExecutables need some special care
+      if (content is IOptimizer) {
+        ((IOptimizer)content).Runs.Clear();
+      }
+      if (content is IExecutable) {
+        IExecutable exec = content as IExecutable;
+        if (exec.ExecutionState != ExecutionState.Prepared) {
+          exec.Prepare();
+        }
+      }
+
+      HiveClient.Instance.Refresh();
+
+      ItemTask hiveTask = ItemTask.GetItemTaskForItem(content);
+      HiveTask task = hiveTask.CreateHiveTask();
+      RefreshableJob rJob = new RefreshableJob();
+      rJob.Job.Name = content.ToString();
+      rJob.HiveTasks.Add(task);
+      task.ItemTask.ComputeInParallel = content is Experiment || content is BatchRun;
+
+      MainFormManager.MainForm.ShowContent(rJob);
+    }
+  }
+}
Index: branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/MenuItems/JobManagerMenuItem.cs
===================================================================
--- branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/MenuItems/JobManagerMenuItem.cs	(revision 11203)
+++ branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/MenuItems/JobManagerMenuItem.cs	(revision 11204)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -22,8 +22,8 @@
 using System.Collections.Generic;
 using System.Windows.Forms;
-using HeuristicLab.Clients.Hive;
 using HeuristicLab.MainForm;
+using HeuristicLab.Optimizer;
 
-namespace HeuristicLab.Optimizer.MenuItems {
+namespace HeuristicLab.Clients.Hive.JobManager {
   public class JobManagerMenuItem : HeuristicLab.MainForm.WindowsForms.MenuItem, IOptimizerUserInterfaceItemProvider {
     public override string Name {
Index: branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/MenuItems/RunInHiveMenuItem.cs
===================================================================
--- branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/MenuItems/RunInHiveMenuItem.cs	(revision 11204)
+++ branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/MenuItems/RunInHiveMenuItem.cs	(revision 11204)
@@ -0,0 +1,104 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Threading;
+using HeuristicLab.Core;
+using HeuristicLab.MainForm;
+using HeuristicLab.Optimization;
+using HeuristicLab.Optimizer;
+using HeuristicLab.PluginInfrastructure;
+
+namespace HeuristicLab.Clients.Hive.JobManager {
+  public class RunInHiveMenuItem : HeuristicLab.MainForm.WindowsForms.MenuItem, IOptimizerUserInterfaceItemProvider {
+    public override string Name {
+      get { return "&Run In Hive"; }
+    }
+    public override IEnumerable<string> Structure {
+      get { return new string[] { "&Services", "&Hive" }; }
+    }
+
+    public override int Position {
+      get { return 10002; }
+    }
+
+    protected override void OnActiveViewChanged(object sender, EventArgs e) {
+      IContentView activeView = MainFormManager.MainForm.ActiveView as IContentView;
+
+      if (activeView != null && activeView.Content != null && !activeView.Locked) {
+        var content = activeView.Content as IItem;
+        if (content != null) {
+          Type contentType = content.GetType();
+          ToolStripItem.Enabled = ItemTask.IsTypeSupported(contentType);
+          return;
+        }
+      }
+      ToolStripItem.Enabled = false;
+    }
+
+    private IProgress progress;
+    private IItem content;
+    public override void Execute() {
+      IContentView activeView = MainFormManager.MainForm.ActiveView as IContentView;
+      content = activeView.Content as IItem;
+
+      //IOptimizer and IExecutables need some special care
+      if (content is IOptimizer) {
+        ((IOptimizer)content).Runs.Clear();
+      }
+      if (content is IExecutable) {
+        IExecutable exec = content as IExecutable;
+        if (exec.ExecutionState != ExecutionState.Prepared) {
+          exec.Prepare();
+        }
+      }
+
+      HiveClient.Instance.Refresh();
+
+      ItemTask hiveTask = ItemTask.GetItemTaskForItem(content);
+      HiveTask task = hiveTask.CreateHiveTask();
+      RefreshableJob rJob = new RefreshableJob();
+      rJob.Job.Name = content.ToString();
+      rJob.HiveTasks.Add(task);
+      task.ItemTask.ComputeInParallel = content is Experiment || content is BatchRun;
+
+      progress = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().AddOperationProgressToContent(this.content, "Uploading to Hive...");
+      rJob.Progress = progress;
+      progress.ProgressStateChanged += progress_ProgressStateChanged;
+
+      HiveClient.StartJob(new Action<Exception>(HandleEx), rJob, new CancellationToken());
+    }
+
+    private void progress_ProgressStateChanged(object sender, EventArgs e) {
+      if (progress.ProgressState != ProgressState.Started) {
+        MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromContent(content);
+        progress.ProgressStateChanged -= progress_ProgressStateChanged;
+      }
+    }
+
+    private void HandleEx(Exception ex) {
+      MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromContent(content);
+      progress.ProgressStateChanged -= progress_ProgressStateChanged;
+      ErrorHandling.ShowErrorDialog("Error uploading tasks", ex);
+    }
+  }
+}
Index: branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Plugin.cs.frame
===================================================================
--- branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Plugin.cs.frame	(revision 11203)
+++ branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Plugin.cs.frame	(revision 11204)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,5 +23,5 @@
 
 namespace HeuristicLab.Clients.Hive.JobManager {
-  [Plugin("HeuristicLab.Clients.Hive.JobManager", "3.3.7.$WCREV$")]
+  [Plugin("HeuristicLab.Clients.Hive.JobManager", "3.3.10.$WCREV$")]
   [PluginFile("HeuristicLab.Clients.Hive.JobManager-3.3.dll", PluginFileType.Assembly)]
   [PluginDependency("HeuristicLab.Clients.Hive", "3.3")]
Index: branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Properties/AssemblyInfo.cs.frame
===================================================================
--- branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Properties/AssemblyInfo.cs.frame	(revision 11203)
+++ branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Properties/AssemblyInfo.cs.frame	(revision 11204)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -32,5 +32,5 @@
 [assembly: AssemblyCompany("HEAL")]
 [assembly: AssemblyProduct("HeuristicLab")]
-[assembly: AssemblyCopyright("(c) 2002-2012 HEAL")]
+[assembly: AssemblyCopyright("(c) 2002-2014 HEAL")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
@@ -55,3 +55,3 @@
 // [assembly: AssemblyVersion("1.0.*")]
 [assembly: AssemblyVersion("3.3.0.0")]
-[assembly: AssemblyFileVersion("3.3.7.$WCREV$")]
+[assembly: AssemblyFileVersion("3.3.10.$WCREV$")]
Index: branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveJobManagerView.Designer.cs
===================================================================
--- branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveJobManagerView.Designer.cs	(revision 11203)
+++ branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveJobManagerView.Designer.cs	(revision 11204)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveJobManagerView.cs
===================================================================
--- branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveJobManagerView.cs	(revision 11203)
+++ branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveJobManagerView.cs	(revision 11204)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveJobPermissionListView.Designer.cs
===================================================================
--- branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveJobPermissionListView.Designer.cs	(revision 11203)
+++ branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveJobPermissionListView.Designer.cs	(revision 11204)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveJobPermissionListView.cs
===================================================================
--- branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveJobPermissionListView.cs	(revision 11203)
+++ branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveJobPermissionListView.cs	(revision 11204)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveJobPermissionView.Designer.cs
===================================================================
--- branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveJobPermissionView.Designer.cs	(revision 11203)
+++ branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveJobPermissionView.Designer.cs	(revision 11204)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveJobPermissionView.cs
===================================================================
--- branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveJobPermissionView.cs	(revision 11203)
+++ branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveJobPermissionView.cs	(revision 11204)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelector.Designer.cs
===================================================================
--- branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelector.Designer.cs	(revision 11203)
+++ branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelector.Designer.cs	(revision 11204)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelector.cs
===================================================================
--- branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelector.cs	(revision 11203)
+++ branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelector.cs	(revision 11204)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -42,7 +42,5 @@
     private ISet<TreeNode> filteredTreeNodes;
     private ISet<TreeNode> nodeStore;
-    private Progress progress;
-    private ProgressView progressView;
-
+    
     private ISet<Resource> selectedResources;
     public ISet<Resource> SelectedResources {
@@ -64,30 +62,12 @@
       imageList.Images.Add(HeuristicLab.Common.Resources.VSImageLibrary.MonitorLarge);
       imageList.Images.Add(HeuristicLab.Common.Resources.VSImageLibrary.NetworkCenterLarge);
-      progress = new Progress() {
-        CanBeCanceled = false,
-        ProgressState = ProgressState.Finished
-      };
-    }
-
-    protected override void DeregisterContentEvents() {
-      if (progressView != null) {
-        progressView.Content = null;
-        progressView.Dispose();
-        progressView = null;
-      }
-      base.DeregisterContentEvents();
-    }
-
-    protected override void RegisterContentEvents() {
-      base.RegisterContentEvents();
-      progressView = new ProgressView(this, progress);
-    }
-
+    }
+  
     public void StartProgressView() {
       if (InvokeRequired) {
         Invoke(new Action(StartProgressView));
       } else {
-        progress.Status = "Downloading resources. Please be patient.";
-        progress.ProgressState = ProgressState.Started;
+        var message = "Downloading resources. Please be patient.";
+        MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, message);
       }
     }
@@ -97,5 +77,5 @@
         Invoke(new Action(FinishProgressView));
       } else {
-        progress.Finish();
+        MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this);
       }
     }
Index: branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelectorDialog.Designer.cs
===================================================================
--- branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelectorDialog.Designer.cs	(revision 11203)
+++ branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelectorDialog.Designer.cs	(revision 11204)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelectorDialog.cs
===================================================================
--- branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelectorDialog.cs	(revision 11203)
+++ branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelectorDialog.cs	(revision 11204)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobListView.Designer.cs
===================================================================
--- branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobListView.Designer.cs	(revision 11203)
+++ branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobListView.Designer.cs	(revision 11204)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobListView.cs
===================================================================
--- branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobListView.cs	(revision 11203)
+++ branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobListView.cs	(revision 11204)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -34,7 +34,4 @@
   [Content(typeof(ItemCollection<RefreshableJob>), false)]
   public partial class RefreshableHiveJobListView : HeuristicLab.Core.Views.ItemCollectionView<RefreshableJob> {
-    private Progress progress;
-    private ProgressView progressView;
-
     public RefreshableHiveJobListView() {
       InitializeComponent();
@@ -44,19 +41,17 @@
       this.itemsListView.Columns.Add(new ColumnHeader("Date") { Text = "Date" });
       this.itemsListView.Columns.Add(new ColumnHeader("Name") { Text = "Name" });
-      foreach (ColumnHeader c in this.itemsListView.Columns) {
-        c.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
-      }
+
       this.itemsListView.HeaderStyle = ColumnHeaderStyle.Clickable;
       this.itemsListView.FullRowSelect = true;
 
       this.itemsListView.ListViewItemSorter = new ListViewItemDateComparer(0, SortOrder.Ascending);
-      this.itemsListView.Sorting = SortOrder.Ascending;
-      this.itemsListView.Sort();
-
-      progress = new Progress() {
-        CanBeCanceled = false,
-        ProgressState = ProgressState.Finished
-      };
-      progressView = new ProgressView(this, progress);
+    }
+
+    protected override void SortItemsListView(SortOrder sortOrder) {
+      if (itemsListView.Sorting == sortOrder || sortOrder == SortOrder.None) return;
+      ((ListViewItemDateComparer)itemsListView.ListViewItemSorter).Order = sortOrder;
+      itemsListView.Sorting = sortOrder;
+      itemsListView.Sort();
+      AdjustListViewColumnSizes();
     }
 
@@ -114,5 +109,5 @@
 
         task.ContinueWith((t) => {
-          progress.Finish();
+          MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this);
           ErrorHandling.ShowErrorDialog("An error occured while deleting the job. ", t.Exception);
         }, TaskContinuationOptions.OnlyOnFaulted);
@@ -125,11 +120,9 @@
 
     private void DeleteHiveJobsAsync(object items) {
-      progress.Status = "Deleting job...";
-      progress.ProgressState = ProgressState.Started;
-      progress.ProgressValue = 0.0;
+      MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, "Deleting job...");
       foreach (RefreshableJob item in (List<RefreshableJob>)items) {
         Content.Remove(item);
       }
-      progress.Finish();
+      MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this);
     }
 
@@ -223,6 +216,4 @@
       if (disposing) {
         if (components != null) components.Dispose();
-        progressView.Content = null;
-        progressView.Dispose();
       }
       base.Dispose(disposing);
Index: branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.Designer.cs
===================================================================
--- branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.Designer.cs	(revision 11203)
+++ branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.Designer.cs	(revision 11204)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.cs
===================================================================
--- branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.cs	(revision 11203)
+++ branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.cs	(revision 11204)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -42,6 +42,4 @@
   [Content(typeof(RefreshableJob), true)]
   public partial class RefreshableHiveJobView : HeuristicLab.Core.Views.ItemView {
-    private Progress progress;
-    private ProgressView progressView;
     private HiveResourceSelectorDialog hiveResourceSelectorDialog;
     private bool SuppressEvents { get; set; }
@@ -58,8 +56,4 @@
     public RefreshableHiveJobView() {
       InitializeComponent();
-      progress = new Progress() {
-        CanBeCanceled = false,
-        ProgressState = ProgressState.Finished
-      };
     }
 
@@ -72,5 +66,4 @@
       Content.ExceptionOccured += new EventHandler<EventArgs<Exception>>(Content_ExceptionOccured);
       Content.StateLogListChanged += new EventHandler(Content_StateLogListChanged);
-      Content.IsProgressingChanged += new EventHandler(Content_IsProgressingChanged);
       Content.HiveTasksChanged += new EventHandler(Content_HiveTasksChanged);
       Content.ExecutionStateChanged += new EventHandler(Content_ExecutionStateChanged);
@@ -78,5 +71,5 @@
       Content.Loaded += new EventHandler(Content_Loaded);
       Content.TaskReceived += new EventHandler(Content_TaskReceived);
-      progressView = new ProgressView(this, progress);
+      MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, Content.Progress);
     }
 
@@ -88,5 +81,4 @@
       Content.ExceptionOccured -= new EventHandler<EventArgs<Exception>>(Content_ExceptionOccured);
       Content.StateLogListChanged -= new EventHandler(Content_StateLogListChanged);
-      Content.IsProgressingChanged -= new EventHandler(Content_IsProgressingChanged);
       Content.HiveTasksChanged -= new EventHandler(Content_HiveTasksChanged);
       Content.ExecutionStateChanged -= new EventHandler(Content_ExecutionStateChanged);
@@ -94,9 +86,5 @@
       Content.Loaded -= new EventHandler(Content_Loaded);
       Content.TaskReceived -= new EventHandler(Content_TaskReceived);
-      if (progressView != null) {
-        progressView.Content = null;
-        progressView.Dispose();
-        progressView = null;
-      }
+      MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this, false);
       DeregisterHiveExperimentEvents();
       DeregisterHiveTasksEvents();
@@ -159,5 +147,4 @@
       Content_HiveExperimentChanged(this, EventArgs.Empty);
       Content_HiveTasksChanged(this, EventArgs.Empty);
-      Content_IsProgressingChanged(this, EventArgs.Empty);
       Content_StateLogListChanged(this, EventArgs.Empty);
       HiveExperiment_PropertyChanged(this, new PropertyChangedEventArgs("Id"));
@@ -260,38 +247,5 @@
         SetEnabledStateOfControls();
     }
-    private void Content_Prepared(object sender, EventArgs e) {
-      if (InvokeRequired)
-        Invoke(new EventHandler(Content_Prepared), sender, e);
-      else {
-        nameTextBox.Enabled = true;
-        Locked = false;
-        SetEnabledStateOfControls();
-      }
-    }
-    private void Content_Started(object sender, EventArgs e) {
-      if (InvokeRequired)
-        Invoke(new EventHandler(Content_Started), sender, e);
-      else {
-        nameTextBox.Enabled = false;
-        SetEnabledStateOfControls();
-      }
-    }
-    private void Content_Paused(object sender, EventArgs e) {
-      if (InvokeRequired)
-        Invoke(new EventHandler(Content_Paused), sender, e);
-      else {
-        nameTextBox.Enabled = true;
-        SetEnabledStateOfControls();
-      }
-    }
-    private void Content_Stopped(object sender, EventArgs e) {
-      if (InvokeRequired)
-        Invoke(new EventHandler(Content_Stopped), sender, e);
-      else {
-        nameTextBox.Enabled = true;
-        Locked = false;
-        SetEnabledStateOfControls();
-      }
-    }
+
     private void Content_ExecutionTimeChanged(object sender, EventArgs e) {
       if (InvokeRequired)
@@ -326,5 +280,9 @@
         runCollectionViewHost.Content = GetAllRunsFromJob(Content);
       }
-      isPrivilegedCheckBox.Checked = Content.Job.IsPrivileged;
+      if (InvokeRequired) {
+        Invoke(new Action(() => { isPrivilegedCheckBox.Checked = Content.Job.IsPrivileged; }));
+      } else {
+        isPrivilegedCheckBox.Checked = Content.Job.IsPrivileged;
+      }
     }
 
@@ -332,5 +290,4 @@
       if (Content != null && Content.Job != null) {
         RegisterHiveExperimentEvents();
-        Content_IsProgressingChanged(sender, e);
       }
     }
@@ -406,5 +363,5 @@
         var task = System.Threading.Tasks.Task.Factory.StartNew(ResumeJobAsync, Content);
         task.ContinueWith((t) => {
-          progress.Finish();
+          Content.Progress.Finish();
           MessageBox.Show("An error occured resuming the job. See the log for more information.", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Error);
           Content.Log.LogException(t.Exception);
@@ -418,5 +375,5 @@
       var task = System.Threading.Tasks.Task.Factory.StartNew(PauseJobAsync, Content);
       task.ContinueWith((t) => {
-        progress.Finish();
+        Content.Progress.Finish();
         MessageBox.Show("An error occured pausing the job. See the log for more information.", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Content.Log.LogException(t.Exception);
@@ -427,5 +384,5 @@
       var task = System.Threading.Tasks.Task.Factory.StartNew(StopJobAsync, Content);
       task.ContinueWith((t) => {
-        progress.Finish();
+        Content.Progress.Finish();
         MessageBox.Show("An error occured stopping the job. See the log for more information.", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Content.Log.LogException(t.Exception);
@@ -435,22 +392,19 @@
 
     private void PauseJobAsync(object job) {
-      progress.Status = "Pausing job...";
-      progress.ProgressState = ProgressState.Started;
+      Content.Progress.Start("Pausing job...");
       HiveClient.PauseJob((RefreshableJob)job);
-      progress.Finish();
+      Content.Progress.Finish();
     }
 
     private void StopJobAsync(object job) {
-      progress.Status = "Stopping job...";
-      progress.ProgressState = ProgressState.Started;
+      Content.Progress.Start("Stopping job...");
       HiveClient.StopJob((RefreshableJob)job);
-      progress.Finish();
+      Content.Progress.Finish();
     }
 
     private void ResumeJobAsync(object job) {
-      progress.Status = "Resuming job...";
-      progress.ProgressState = ProgressState.Started;
+      Content.Progress.Start("Resuming job...");
       HiveClient.ResumeJob((RefreshableJob)job);
-      progress.Finish();
+      Content.Progress.Finish();
     }
 
@@ -507,18 +461,4 @@
     #endregion
 
-    #region Progress reporting
-    private void Content_IsProgressingChanged(object sender, EventArgs e) {
-      if (this.InvokeRequired) {
-        Invoke(new EventHandler(Content_IsProgressingChanged), sender, e);
-      } else {
-        if (Content != null && Content.Progress != null && Content.IsProgressing) {
-          progressView.Content = Content.Progress;
-        } else if (Content != null) {
-          progressView.Content = progress;
-        }
-      }
-    }
-    #endregion
-
     #region Drag & Drop
     private void jobsTreeView_DragOver(object sender, DragEventArgs e) {
@@ -528,6 +468,8 @@
     private void jobsTreeView_DragEnter(object sender, DragEventArgs e) {
       e.Effect = DragDropEffects.None;
-      var obj = e.Data.GetData(Constants.DragDropDataFormat);
-      if (obj is IOptimizer) {
+      var obj = (IDeepCloneable)e.Data.GetData(Constants.DragDropDataFormat);
+
+      Type objType = obj.GetType();
+      if (ItemTask.IsTypeSupported(objType)) {
         if (Content.Id != Guid.Empty) e.Effect = DragDropEffects.None;
         else if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link;  // ALT key
@@ -538,21 +480,26 @@
     private void jobsTreeView_DragDrop(object sender, DragEventArgs e) {
       if (e.Effect != DragDropEffects.None) {
-        var obj = e.Data.GetData(Constants.DragDropDataFormat);
-
-        var optimizer = obj as IOptimizer;
-        if (optimizer != null) {
-          IOptimizer newOptimizer = null;
-          if (e.Effect.HasFlag(DragDropEffects.Copy)) {
-            newOptimizer = (IOptimizer)optimizer.Clone();
-            newOptimizer.Runs.Clear();
-          } else {
-            newOptimizer = optimizer;
+        var obj = (IItem)e.Data.GetData(Constants.DragDropDataFormat);
+
+        IItem newObj = null;
+        if (e.Effect.HasFlag(DragDropEffects.Copy)) {
+          newObj = (IItem)obj.Clone();
+        } else {
+          newObj = obj;
+        }
+
+        //IOptimizer and IExecutables need some special care
+        if (newObj is IOptimizer) {
+          ((IOptimizer)newObj).Runs.Clear();
+        }
+        if (newObj is IExecutable) {
+          IExecutable exec = (IExecutable)newObj;
+          if (exec.ExecutionState != ExecutionState.Prepared) {
+            exec.Prepare();
           }
-          if (newOptimizer.ExecutionState != ExecutionState.Prepared) {
-            newOptimizer.Prepare();
-          }
-
-          Content.HiveTasks.Add(new OptimizerHiveTask(newOptimizer));
-        }
+        }
+
+        ItemTask hiveTask = ItemTask.GetItemTaskForItem(newObj);
+        Content.HiveTasks.Add(hiveTask.CreateHiveTask());
       }
     }
