Index: addons/HeuristicLab.MetaOptimization/HeuristicLab.HiveEngine.Views/3.3/HeuristicLab.HiveEngine.Views-3.3.csproj
===================================================================
--- addons/HeuristicLab.MetaOptimization/HeuristicLab.HiveEngine.Views/3.3/HeuristicLab.HiveEngine.Views-3.3.csproj	(revision 15741)
+++ addons/HeuristicLab.MetaOptimization/HeuristicLab.HiveEngine.Views/3.3/HeuristicLab.HiveEngine.Views-3.3.csproj	(revision 16173)
@@ -125,4 +125,8 @@
       <Private>False</Private>
     </Reference>
+    <Reference Include="HeuristicLab.Common.Resources-3.3">
+      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Common.Resources-3.3.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
     <Reference Include="HeuristicLab.Core-3.3">
       <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Core-3.3.dll</HintPath>
@@ -173,9 +177,4 @@
     </ProjectReference>
   </ItemGroup>
-  <ItemGroup>
-    <EmbeddedResource Include="HiveEngineView.resx">
-      <DependentUpon>HiveEngineView.cs</DependentUpon>
-    </EmbeddedResource>
-  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <PropertyGroup>
Index: addons/HeuristicLab.MetaOptimization/HeuristicLab.HiveEngine.Views/3.3/HiveEngineView.Designer.cs
===================================================================
--- addons/HeuristicLab.MetaOptimization/HeuristicLab.HiveEngine.Views/3.3/HiveEngineView.Designer.cs	(revision 15741)
+++ addons/HeuristicLab.MetaOptimization/HeuristicLab.HiveEngine.Views/3.3/HiveEngineView.Designer.cs	(revision 16173)
@@ -25,8 +25,7 @@
     /// </summary>
     private void InitializeComponent() {
-      this.resourceIdsLabel = new System.Windows.Forms.Label();
-      this.resourceIdsTextBox = new System.Windows.Forms.TextBox();
+      this.projectLabel = new System.Windows.Forms.Label();
+      this.projectNameTextBox = new System.Windows.Forms.TextBox();
       this.priorityLabel = new System.Windows.Forms.Label();
-      this.priorityTextBox = new System.Windows.Forms.TextBox();
       this.label1 = new System.Windows.Forms.Label();
       this.executionTimeOnHiveTextBox = new System.Windows.Forms.TextBox();
@@ -38,4 +37,6 @@
       this.executionTimeLabel = new System.Windows.Forms.Label();
       this.executionTimeTextBox = new System.Windows.Forms.TextBox();
+      this.priorityComboBox = new System.Windows.Forms.ComboBox();
+      this.searchButton = new System.Windows.Forms.Button();
       this.tabControl.SuspendLayout();
       this.jobsTabPage.SuspendLayout();
@@ -43,42 +44,32 @@
       this.SuspendLayout();
       // 
-      // resourceIdsLabel
-      // 
-      this.resourceIdsLabel.AutoSize = true;
-      this.resourceIdsLabel.Location = new System.Drawing.Point(113, 55);
-      this.resourceIdsLabel.Name = "resourceIdsLabel";
-      this.resourceIdsLabel.Size = new System.Drawing.Size(70, 13);
-      this.resourceIdsLabel.TabIndex = 3;
-      this.resourceIdsLabel.Text = "ResourceIds:";
-      // 
-      // resourceIdsTextBox
-      // 
-      this.resourceIdsTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
-            | System.Windows.Forms.AnchorStyles.Left) 
-            | System.Windows.Forms.AnchorStyles.Right)));
-      this.resourceIdsTextBox.Location = new System.Drawing.Point(189, 52);
-      this.resourceIdsTextBox.Name = "resourceIdsTextBox";
-      this.resourceIdsTextBox.Size = new System.Drawing.Size(517, 20);
-      this.resourceIdsTextBox.TabIndex = 4;
-      this.resourceIdsTextBox.Text = "HEAL";
-      this.resourceIdsTextBox.Validated += new System.EventHandler(this.resourceIdsTextBox_Validated);
+      // projectLabel
+      // 
+      this.projectLabel.AutoSize = true;
+      this.projectLabel.Location = new System.Drawing.Point(3, 55);
+      this.projectLabel.Name = "projectLabel";
+      this.projectLabel.Size = new System.Drawing.Size(43, 13);
+      this.projectLabel.TabIndex = 3;
+      this.projectLabel.Text = "Project:";
+      // 
+      // projectNameTextBox
+      // 
+      this.projectNameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
+            | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+      this.projectNameTextBox.Location = new System.Drawing.Point(162, 52);
+      this.projectNameTextBox.Name = "projectNameTextBox";
+      this.projectNameTextBox.ReadOnly = true;
+      this.projectNameTextBox.Size = new System.Drawing.Size(544, 20);
+      this.projectNameTextBox.TabIndex = 4;
       // 
       // priorityLabel
       // 
       this.priorityLabel.AutoSize = true;
-      this.priorityLabel.Location = new System.Drawing.Point(3, 55);
+      this.priorityLabel.Location = new System.Drawing.Point(3, 81);
       this.priorityLabel.Name = "priorityLabel";
       this.priorityLabel.Size = new System.Drawing.Size(41, 13);
       this.priorityLabel.TabIndex = 5;
       this.priorityLabel.Text = "Priority:";
-      // 
-      // priorityTextBox
-      // 
-      this.priorityTextBox.Location = new System.Drawing.Point(50, 52);
-      this.priorityTextBox.Name = "priorityTextBox";
-      this.priorityTextBox.Size = new System.Drawing.Size(57, 20);
-      this.priorityTextBox.TabIndex = 6;
-      this.priorityTextBox.Text = "0";
-      this.priorityTextBox.Validated += new System.EventHandler(this.priorityTextBox_Validated);
       // 
       // label1
@@ -96,8 +87,8 @@
             | System.Windows.Forms.AnchorStyles.Left) 
             | System.Windows.Forms.AnchorStyles.Right)));
-      this.executionTimeOnHiveTextBox.Location = new System.Drawing.Point(129, 26);
+      this.executionTimeOnHiveTextBox.Location = new System.Drawing.Point(132, 26);
       this.executionTimeOnHiveTextBox.Name = "executionTimeOnHiveTextBox";
       this.executionTimeOnHiveTextBox.ReadOnly = true;
-      this.executionTimeOnHiveTextBox.Size = new System.Drawing.Size(577, 20);
+      this.executionTimeOnHiveTextBox.Size = new System.Drawing.Size(574, 20);
       this.executionTimeOnHiveTextBox.TabIndex = 8;
       // 
@@ -109,8 +100,8 @@
       this.tabControl.Controls.Add(this.jobsTabPage);
       this.tabControl.Controls.Add(this.logTabPage);
-      this.tabControl.Location = new System.Drawing.Point(3, 78);
+      this.tabControl.Location = new System.Drawing.Point(3, 105);
       this.tabControl.Name = "tabControl";
       this.tabControl.SelectedIndex = 0;
-      this.tabControl.Size = new System.Drawing.Size(700, 460);
+      this.tabControl.Size = new System.Drawing.Size(700, 433);
       this.tabControl.TabIndex = 9;
       // 
@@ -121,5 +112,5 @@
       this.jobsTabPage.Name = "jobsTabPage";
       this.jobsTabPage.Padding = new System.Windows.Forms.Padding(3);
-      this.jobsTabPage.Size = new System.Drawing.Size(692, 434);
+      this.jobsTabPage.Size = new System.Drawing.Size(692, 407);
       this.jobsTabPage.TabIndex = 0;
       this.jobsTabPage.Text = "Jobs";
@@ -135,5 +126,5 @@
       this.hiveExperimentListView.ReadOnly = false;
       this.hiveExperimentListView.ShowDetails = true;
-      this.hiveExperimentListView.Size = new System.Drawing.Size(686, 428);
+      this.hiveExperimentListView.Size = new System.Drawing.Size(686, 401);
       this.hiveExperimentListView.TabIndex = 0;
       // 
@@ -144,5 +135,5 @@
       this.logTabPage.Name = "logTabPage";
       this.logTabPage.Padding = new System.Windows.Forms.Padding(3);
-      this.logTabPage.Size = new System.Drawing.Size(692, 434);
+      this.logTabPage.Size = new System.Drawing.Size(692, 410);
       this.logTabPage.TabIndex = 1;
       this.logTabPage.Text = "Log";
@@ -157,5 +148,5 @@
       this.logView.Name = "logView";
       this.logView.ReadOnly = false;
-      this.logView.Size = new System.Drawing.Size(686, 428);
+      this.logView.Size = new System.Drawing.Size(686, 404);
       this.logView.TabIndex = 0;
       // 
@@ -163,5 +154,5 @@
       // 
       this.executionTimeLabel.AutoSize = true;
-      this.executionTimeLabel.Location = new System.Drawing.Point(4, 6);
+      this.executionTimeLabel.Location = new System.Drawing.Point(3, 6);
       this.executionTimeLabel.Name = "executionTimeLabel";
       this.executionTimeLabel.Size = new System.Drawing.Size(83, 13);
@@ -174,9 +165,36 @@
             | System.Windows.Forms.AnchorStyles.Left) 
             | System.Windows.Forms.AnchorStyles.Right)));
-      this.executionTimeTextBox.Location = new System.Drawing.Point(129, 3);
+      this.executionTimeTextBox.Location = new System.Drawing.Point(132, 3);
       this.executionTimeTextBox.Name = "executionTimeTextBox";
       this.executionTimeTextBox.ReadOnly = true;
-      this.executionTimeTextBox.Size = new System.Drawing.Size(577, 20);
+      this.executionTimeTextBox.Size = new System.Drawing.Size(574, 20);
       this.executionTimeTextBox.TabIndex = 11;
+      // 
+      // priorityComboBox
+      // 
+      this.priorityComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+      this.priorityComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+      this.priorityComboBox.FormattingEnabled = true;
+      this.priorityComboBox.Items.AddRange(new object[] {
+            "Low",
+            "Normal",
+            "Urgent",
+            "Critical"});
+      this.priorityComboBox.Location = new System.Drawing.Point(132, 78);
+      this.priorityComboBox.Name = "priorityComboBox";
+      this.priorityComboBox.Size = new System.Drawing.Size(574, 21);
+      this.priorityComboBox.TabIndex = 44;
+      this.priorityComboBox.SelectedIndexChanged += new System.EventHandler(this.priorityComboBox_SelectedIndexChanged);
+      // 
+      // searchButton
+      // 
+      this.searchButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Zoom;
+      this.searchButton.Location = new System.Drawing.Point(132, 49);
+      this.searchButton.Name = "searchButton";
+      this.searchButton.Size = new System.Drawing.Size(24, 24);
+      this.searchButton.TabIndex = 45;
+      this.searchButton.UseVisualStyleBackColor = true;
+      this.searchButton.Click += new System.EventHandler(this.searchButton_Click);
       // 
       // HiveEngineView
@@ -184,4 +202,6 @@
       this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+      this.Controls.Add(this.searchButton);
+      this.Controls.Add(this.priorityComboBox);
       this.Controls.Add(this.executionTimeTextBox);
       this.Controls.Add(this.executionTimeLabel);
@@ -189,8 +209,7 @@
       this.Controls.Add(this.label1);
       this.Controls.Add(this.executionTimeOnHiveTextBox);
-      this.Controls.Add(this.priorityTextBox);
       this.Controls.Add(this.priorityLabel);
-      this.Controls.Add(this.resourceIdsLabel);
-      this.Controls.Add(this.resourceIdsTextBox);
+      this.Controls.Add(this.projectLabel);
+      this.Controls.Add(this.projectNameTextBox);
       this.Name = "HiveEngineView";
       this.Size = new System.Drawing.Size(706, 541);
@@ -205,8 +224,7 @@
     #endregion
 
-    private System.Windows.Forms.Label resourceIdsLabel;
-    private System.Windows.Forms.TextBox resourceIdsTextBox;
+    private System.Windows.Forms.Label projectLabel;
+    private System.Windows.Forms.TextBox projectNameTextBox;
     private System.Windows.Forms.Label priorityLabel;
-    private System.Windows.Forms.TextBox priorityTextBox;
     private System.Windows.Forms.Label label1;
     private System.Windows.Forms.TextBox executionTimeOnHiveTextBox;
@@ -218,4 +236,6 @@
     private HeuristicLab.Core.Views.LogView logView;
     private RefreshableHiveJobListView hiveExperimentListView;
+    protected System.Windows.Forms.ComboBox priorityComboBox;
+    private System.Windows.Forms.Button searchButton;
   }
 }
Index: addons/HeuristicLab.MetaOptimization/HeuristicLab.HiveEngine.Views/3.3/HiveEngineView.cs
===================================================================
--- addons/HeuristicLab.MetaOptimization/HeuristicLab.HiveEngine.Views/3.3/HiveEngineView.cs	(revision 15741)
+++ addons/HeuristicLab.MetaOptimization/HeuristicLab.HiveEngine.Views/3.3/HiveEngineView.cs	(revision 16173)
@@ -21,4 +21,9 @@
 
 using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+using HeuristicLab.Clients.Hive;
+using HeuristicLab.Clients.Hive.JobManager.Views;
 using HeuristicLab.Core.Views;
 using HeuristicLab.MainForm;
@@ -28,4 +33,6 @@
   [Content(typeof(HiveEngine), IsDefaultView = true)]
   public sealed partial class HiveEngineView : ItemView {
+    private readonly HiveResourceSelectorDialog hiveResourceSelectorDialog = new HiveResourceSelectorDialog(Guid.Empty, Guid.Empty);
+
     public new HiveEngine Content {
       get { return (HiveEngine)base.Content; }
@@ -70,12 +77,23 @@
       base.OnContentChanged();
       if (Content == null) {
-        resourceIdsTextBox.Text = string.Empty;
-        priorityTextBox.Text = string.Empty;
+        projectNameTextBox.Text = string.Empty;
+        priorityComboBox.SelectedIndex = 1;
         executionTimeOnHiveTextBox.Text = string.Empty;
         hiveExperimentListView.Content = null;
         logView.Content = null;
       } else {
-        resourceIdsTextBox.Text = Content.ResourceNames;
-        priorityTextBox.Text = Content.Priority.ToString();
+        if (Content.ProjectId != null && Content.ProjectId != Guid.Empty) {
+          var project = HiveServiceLocator.Instance.CallHiveService(s => s.GetProject(Content.ProjectId));
+          if (project != null) projectNameTextBox.Text = project.Name;
+        } else {
+          projectNameTextBox.Text = string.Empty;
+        }
+
+        if (Content.Priority >= 0 && Content.Priority < priorityComboBox.Items.Count) {
+          priorityComboBox.SelectedIndex = Content.Priority;
+        } else {
+          priorityComboBox.SelectedIndex = 1;
+        }
+
         executionTimeOnHiveTextBox.Text = Content.ExecutionTimeOnHive.ToString();
         hiveExperimentListView.Content = Content.Jobs;
@@ -86,23 +104,34 @@
     protected override void SetEnabledStateOfControls() {
       base.SetEnabledStateOfControls();
-      // Enable or disable controls based on whether the content is null or the view is set readonly
-      if (Content != null) {
-        resourceIdsTextBox.ReadOnly = this.ReadOnly;
-        priorityTextBox.ReadOnly = this.ReadOnly;
-      } else {
-        resourceIdsTextBox.ReadOnly = false;
-        priorityTextBox.ReadOnly = false;
+
+      searchButton.Enabled = Content != null && !ReadOnly && !Locked;
+      projectNameTextBox.Enabled = Content != null && !ReadOnly && !Locked;
+      priorityComboBox.Enabled = Content != null && !ReadOnly && !Locked;
+    }
+
+    private void searchButton_Click(object sender, EventArgs e) {
+      hiveResourceSelectorDialog.SelectedProjectId = Content != null ? Content.ProjectId : Guid.Empty;
+      hiveResourceSelectorDialog.SelectedResourceIds = Content != null ? Content.ResourceIds : new List<Guid>();
+
+      var result = hiveResourceSelectorDialog.ShowDialog(this);
+      if (result == DialogResult.OK) {
+        var selectedProject = hiveResourceSelectorDialog.SelectedProject;
+        if (selectedProject != null) {
+          projectNameTextBox.Text = selectedProject.Name;
+          Content.ProjectId = selectedProject.Id;
+          Content.ResourceIds = hiveResourceSelectorDialog.SelectedResources.Select(x => x.Id).ToList();
+        } else {
+          projectNameTextBox.Text = string.Empty;
+          Content.ProjectId = Guid.Empty;
+          Content.ResourceIds = new List<Guid>();
+        }
       }
     }
 
-    #region Event Handlers (child controls)
-    private void resourceIdsTextBox_Validated(object sender, EventArgs e) {
-      Content.ResourceNames = resourceIdsTextBox.Text;
+    private void priorityComboBox_SelectedIndexChanged(object sender, EventArgs e) {
+      if (Content != null && Content.Priority != priorityComboBox.SelectedIndex) {
+        Content.Priority = priorityComboBox.SelectedIndex;
+      }
     }
-
-    private void priorityTextBox_Validated(object sender, EventArgs e) {
-      Content.Priority = int.Parse(priorityTextBox.Text);
-    }
-    #endregion
   }
 }
Index: addons/HeuristicLab.MetaOptimization/HeuristicLab.HiveEngine.Views/3.3/HiveEngineView.resx
===================================================================
--- addons/HeuristicLab.MetaOptimization/HeuristicLab.HiveEngine.Views/3.3/HiveEngineView.resx	(revision 15741)
+++ 	(revision )
@@ -1,120 +1,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<root>
-  <!-- 
-    Microsoft ResX Schema 
-    
-    Version 2.0
-    
-    The primary goals of this format is to allow a simple XML format 
-    that is mostly human readable. The generation and parsing of the 
-    various data types are done through the TypeConverter classes 
-    associated with the data types.
-    
-    Example:
-    
-    ... ado.net/XML headers & schema ...
-    <resheader name="resmimetype">text/microsoft-resx</resheader>
-    <resheader name="version">2.0</resheader>
-    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
-    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
-    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
-    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
-    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
-        <value>[base64 mime encoded serialized .NET Framework object]</value>
-    </data>
-    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
-        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
-        <comment>This is a comment</comment>
-    </data>
-                
-    There are any number of "resheader" rows that contain simple 
-    name/value pairs.
-    
-    Each data row contains a name, and value. The row also contains a 
-    type or mimetype. Type corresponds to a .NET class that support 
-    text/value conversion through the TypeConverter architecture. 
-    Classes that don't support this are serialized and stored with the 
-    mimetype set.
-    
-    The mimetype is used for serialized objects, and tells the 
-    ResXResourceReader how to depersist the object. This is currently not 
-    extensible. For a given mimetype the value must be set accordingly:
-    
-    Note - application/x-microsoft.net.object.binary.base64 is the format 
-    that the ResXResourceWriter will generate, however the reader can 
-    read any of the formats listed below.
-    
-    mimetype: application/x-microsoft.net.object.binary.base64
-    value   : The object must be serialized with 
-            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
-            : and then encoded with base64 encoding.
-    
-    mimetype: application/x-microsoft.net.object.soap.base64
-    value   : The object must be serialized with 
-            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
-            : and then encoded with base64 encoding.
-
-    mimetype: application/x-microsoft.net.object.bytearray.base64
-    value   : The object must be serialized into a byte array 
-            : using a System.ComponentModel.TypeConverter
-            : and then encoded with base64 encoding.
-    -->
-  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
-    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
-    <xsd:element name="root" msdata:IsDataSet="true">
-      <xsd:complexType>
-        <xsd:choice maxOccurs="unbounded">
-          <xsd:element name="metadata">
-            <xsd:complexType>
-              <xsd:sequence>
-                <xsd:element name="value" type="xsd:string" minOccurs="0" />
-              </xsd:sequence>
-              <xsd:attribute name="name" use="required" type="xsd:string" />
-              <xsd:attribute name="type" type="xsd:string" />
-              <xsd:attribute name="mimetype" type="xsd:string" />
-              <xsd:attribute ref="xml:space" />
-            </xsd:complexType>
-          </xsd:element>
-          <xsd:element name="assembly">
-            <xsd:complexType>
-              <xsd:attribute name="alias" type="xsd:string" />
-              <xsd:attribute name="name" type="xsd:string" />
-            </xsd:complexType>
-          </xsd:element>
-          <xsd:element name="data">
-            <xsd:complexType>
-              <xsd:sequence>
-                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
-                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
-              </xsd:sequence>
-              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
-              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
-              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
-              <xsd:attribute ref="xml:space" />
-            </xsd:complexType>
-          </xsd:element>
-          <xsd:element name="resheader">
-            <xsd:complexType>
-              <xsd:sequence>
-                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
-              </xsd:sequence>
-              <xsd:attribute name="name" type="xsd:string" use="required" />
-            </xsd:complexType>
-          </xsd:element>
-        </xsd:choice>
-      </xsd:complexType>
-    </xsd:element>
-  </xsd:schema>
-  <resheader name="resmimetype">
-    <value>text/microsoft-resx</value>
-  </resheader>
-  <resheader name="version">
-    <value>2.0</value>
-  </resheader>
-  <resheader name="reader">
-    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
-  </resheader>
-  <resheader name="writer">
-    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
-  </resheader>
-</root>
Index: addons/HeuristicLab.MetaOptimization/HeuristicLab.HiveEngine/3.3/HiveEngine.cs
===================================================================
--- addons/HeuristicLab.MetaOptimization/HeuristicLab.HiveEngine/3.3/HiveEngine.cs	(revision 15741)
+++ addons/HeuristicLab.MetaOptimization/HeuristicLab.HiveEngine/3.3/HiveEngine.cs	(revision 16173)
@@ -45,5 +45,8 @@
 
     [Storable]
-    public string ResourceNames { get; set; }
+    public Guid ProjectId { get; set; }
+
+    [Storable]
+    public IEnumerable<Guid> ResourceIds { get; set; }
 
     [Storable]
@@ -94,5 +97,6 @@
     #region constructors and cloning
     public HiveEngine() {
-      this.ResourceNames = "HEAL";
+      this.ProjectId = Guid.Empty;
+      this.ResourceIds = new List<Guid>();
       this.Priority = 0;
       this.log = new ThreadSafeLog();
@@ -103,5 +107,6 @@
     protected HiveEngine(HiveEngine original, Cloner cloner)
       : base(original, cloner) {
-      this.ResourceNames = original.ResourceNames;
+      this.ProjectId = original.ProjectId;
+      this.ResourceIds = original.ResourceIds.ToList();
       this.currentOperator = cloner.Clone(original.currentOperator);
       this.priority = original.priority;
@@ -145,4 +150,10 @@
         firstRun = false;
       }
+
+      if (ProjectId == Guid.Empty)
+        throw new ArgumentException("Cannot run HiveEngine. No project has been specified.");
+
+      if (!ResourceIds.Any())
+        throw new ArgumentException("Cannot run HiveEngine. No resources have been specified.");
 
       while (executionStack.Count > 0) {
@@ -175,6 +186,5 @@
                 }
               }
-            }
-            catch {
+            } catch {
               executionStack.Push(coll); throw;
             }
@@ -187,6 +197,5 @@
           try {
             next = operation.Operator.Execute((IExecutionContext)operation, cancellationToken);
-          }
-          catch (Exception ex) {
+          } catch (Exception ex) {
             executionStack.Push(operation);
             if (ex is OperationCanceledException) throw ex;
@@ -217,6 +226,5 @@
         }
         return FindRandomParameter(ec.Parent);
-      }
-      catch { return null; }
+      } catch { return null; }
     }
 
@@ -256,12 +264,18 @@
             random.Reset(random.Next());
         }
+
         HiveClient.StartJob((e) => { log.LogException(e); }, refreshableJob, cancellationToken);
 
         // do polling until experiment is finished and all jobs are downloaded
         while (!refreshableJob.IsFinished()) {
+          if (!refreshableJob.RefreshAutomatically && refreshableJob.Id != Guid.Empty)
+            refreshableJob.RefreshAutomatically = true;
+
           Thread.Sleep(2000);
+
           this.ExecutionTimeOnHive = TimeSpan.FromMilliseconds(jobs.Sum(x => x.ExecutionTime.TotalMilliseconds));
           cancellationToken.ThrowIfCancellationRequested();
         }
+
         log.LogMessage(string.Format("{0} finished (TotalExecutionTime: {1}).", refreshableJob.ToString(), refreshableJob.ExecutionTime));
 
@@ -277,14 +291,12 @@
           scopes[j++] = scope;
         }
+
         return scopes;
-      }
-      catch (OperationCanceledException e) {
+      } catch (OperationCanceledException e) {
         throw e;
-      }
-      catch (Exception e) {
+      } catch (Exception e) {
         log.LogException(e);
         throw e;
-      }
-      finally {
+      } finally {
         DisposeJob(refreshableJob);
       }
@@ -293,11 +305,18 @@
     private RefreshableJob CreateJob() {
       lock (locker) {
-        var hiveExperiment = new Job();
-        hiveExperiment.Name = "HiveEngine Run " + jobs.Count;
-        hiveExperiment.DateCreated = DateTime.Now;
-        hiveExperiment.ResourceNames = this.ResourceNames;
-        var refreshableHiveExperiment = new RefreshableJob(hiveExperiment);
-        refreshableHiveExperiment.IsDownloadable = false; // download happens automatically so disable button
+        var hiveExperiment = new Job {
+          Name = "HiveEngine Run " + jobs.Count,
+          DateCreated = DateTime.Now,
+          ProjectId = ProjectId,
+          ResourceIds = ResourceIds.ToList(),
+        };
+
+        var refreshableHiveExperiment = new RefreshableJob(hiveExperiment) {
+          RefreshAutomatically = false,
+          IsDownloadable = false // download happens automatically later on so disable button
+        };
+
         jobs.Add(refreshableHiveExperiment);
+
         return refreshableHiveExperiment;
       }
@@ -319,21 +338,6 @@
     private void DeleteHiveExperiment(Guid jobId) {
       HiveClient.TryAndRepeat(() => {
-        HiveServiceLocator.Instance.CallHiveService(s => s.DeleteJob(jobId));
+        HiveServiceLocator.Instance.CallHiveService(s => s.UpdateJobState(jobId, JobState.StatisticsPending));
       }, 5, string.Format("Could not delete jobs"));
-    }
-
-    private List<Guid> GetResourceIds() {
-      return HiveServiceLocator.Instance.CallHiveService(service => {
-        var resourceNames = ResourceNames.Split(';');
-        var resourceIds = new List<Guid>();
-        foreach (var resourceName in resourceNames) {
-          Guid resourceId = service.GetResourceId(resourceName);
-          if (resourceId == Guid.Empty) {
-            throw new ResourceNotFoundException(string.Format("Could not find the resource '{0}'", resourceName));
-          }
-          resourceIds.Add(resourceId);
-        }
-        return resourceIds;
-      });
     }
   }
