Index: branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectsView.Designer.cs
===================================================================
--- branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectsView.Designer.cs	(revision 15767)
+++ branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectsView.Designer.cs	(revision 15777)
@@ -126,5 +126,6 @@
       this.projectsTreeView.TabIndex = 9;
       this.projectsTreeView.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.projectsTreeView_ItemDrag);
-      this.projectsTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.projectsTreeView_AfterSelect);
+      this.projectsTreeView.BeforeSelect += new System.Windows.Forms.TreeViewCancelEventHandler(this.projectsTreeView_BeforeSelect);
+      this.projectsTreeView.MouseDown += new System.Windows.Forms.MouseEventHandler(this.projectsTreeView_MouseDown);
       this.projectsTreeView.DragDrop += new System.Windows.Forms.DragEventHandler(this.projectsTreeView_DragDrop);
       this.projectsTreeView.DragEnter += new System.Windows.Forms.DragEventHandler(this.projectsTreeView_DragEnterOver);
Index: branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectsView.cs
===================================================================
--- branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectsView.cs	(revision 15767)
+++ branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectsView.cs	(revision 15777)
@@ -43,5 +43,10 @@
     private readonly Color changedColor = Color.FromArgb(255, 87, 191, 193); // #57bfc1
     private readonly Color selectedColor = Color.FromArgb(255, 240, 194, 59); // #f0c23b
+
     private Project selectedProject = null;
+    public Project SelectedProject {
+      get { return selectedProject; }
+      set { if (selectedProject != value) ChangeSelectedProject(value); }
+    }
 
     private readonly object locker = new object();
@@ -93,13 +98,5 @@
         projectResourcesView.Content = null;
       } else {
-        var top = BuildProjectTree(Content);
-        projectView.Content = top;
-        projectPermissionsView.Content = top;
-        projectResourcesView.Content = top;
-
-        if(top != null && top.Id == Guid.Empty) {
-          projectPermissionsView.Locked = true;
-          projectResourcesView.Locked = true;
-        }
+        BuildProjectTree(Content);
       }
     }
@@ -107,5 +104,5 @@
     protected override void SetEnabledStateOfControls() {
       base.SetEnabledStateOfControls();
-      bool enabled = Content != null && !ReadOnly;
+      bool enabled = Content != null && !Locked && !ReadOnly;
       refreshButton.Enabled = enabled;
       addButton.Enabled = enabled;
@@ -213,5 +210,5 @@
       };
 
-      selectedProject = project;
+      SelectedProject = project;
       Content.Add(project);
     }
@@ -278,16 +275,11 @@
     }
 
-    private void projectsTreeView_AfterSelect(object sender, TreeViewEventArgs e) {
-      ChangeSelectedProjectNode(e.Node);
-
-      //if (projectView.Content != null)
-      //  projectView.Content.PropertyChanged -= ProjectViewContent_PropertyChanged;
-
-      projectView.Content = selectedProject;
-      projectPermissionsView.Content = selectedProject;
-      projectResourcesView.Content = selectedProject;
-
-      //if (selectedProject != null)
-      //  selectedProject.PropertyChanged += ProjectViewContent_PropertyChanged;
+    private void projectsTreeView_MouseDown(object sender, MouseEventArgs e) {
+      var node = projectsTreeView.GetNodeAt(e.Location);
+      if(node != null) ChangeSelectedProjectNode(node);
+    }
+
+    private void projectsTreeView_BeforeSelect(object sender, TreeViewCancelEventArgs e) {
+      e.Cancel = true;
     }
 
@@ -306,22 +298,13 @@
       var targetNode = treeView.GetNodeAt(targetPoint);
 
-      if (sourceNode == targetNode) return;
       var targetProject = (targetNode != null) ? (Project)targetNode.Tag : null;
 
-      if(targetProject != null && targetProject.Id == Guid.Empty) {
+      if (!HiveAdminClient.Instance.CheckParentChange(sourceProject, targetProject)) {
         MessageBox.Show(
-          "You cannot drag projects to a not yet stored project.",
+          "You cannot drag projects to this project.",
           "HeuristicLab Hive Administrator",
           MessageBoxButtons.OK,
           MessageBoxIcon.Information);
         return;
-      }
-      if(!HiveAdminClient.Instance.CheckParentChange(sourceProject, targetProject)) {
-        MessageBox.Show(
-          "You cannot drag to this project.",
-          "HeuristicLab Hive Administrator",
-          MessageBoxButtons.OK,
-          MessageBoxIcon.Information);
-      return;
       }
 
@@ -340,5 +323,5 @@
       }
 
-      selectedProject = sourceProject;
+      SelectedProject = sourceProject;
       OnContentChanged();
     }
@@ -364,6 +347,4 @@
       || sourceProject == null
       || sourceNode == targetNode
-      || (targetProject != null && targetProject.Id == Guid.Empty)
-      || (targetProject != null && targetProject.Id == sourceProject.ParentProjectId)
       || !HiveAdminClient.Instance.CheckParentChange(sourceProject, targetProject)) {
         e.Effect = DragDropEffects.None;
@@ -398,6 +379,19 @@
     }
 
+    private void ChangeSelectedProject(Project project) {
+      projectView.Content = project;
+      projectPermissionsView.Content = project;
+      projectResourcesView.Content = project;
+
+      bool locked = project == null || (project != null && project.Id == Guid.Empty);
+      addButton.Enabled = !locked;
+      projectPermissionsView.Locked = locked;
+      projectResourcesView.Locked = locked;
+      selectedProject = project;
+    }
+
     private void ChangeSelectedProjectNode(TreeNode projectNode) {
-      selectedProject = (Project)projectNode.Tag;
+      if (projectNode == null) return;
+      SelectedProject = (Project)projectNode.Tag;
       ResetTreeNodes(projectsTreeView.Nodes, selectedColor, Color.Transparent, true);
       projectNode.BackColor = selectedColor;
@@ -405,7 +399,7 @@
     }
 
-    private Project BuildProjectTree(IEnumerable<Project> projects) {
+    private void BuildProjectTree(IEnumerable<Project> projects) {
       projectsTreeView.Nodes.Clear();
-      if (!projects.Any()) return null;
+      if (!projects.Any()) return;
 
       var mainProjects = new HashSet<Project>(projects.Where(x => x.ParentProjectId == null));
@@ -417,5 +411,5 @@
 
       var stack = new Stack<Project>(mainProjects.OrderByDescending(x => x.Name));
-      if (selectedProject != null) selectedProject = projects.Where(x => x.Id == selectedProject.Id).FirstOrDefault();
+      if (selectedProject != null) SelectedProject = projects.Where(x => x.Id == selectedProject.Id).FirstOrDefault();
       bool nodeSelected = false;
 
@@ -433,5 +427,5 @@
         }
         if (selectedProject == null) {
-          selectedProject = newProject;
+          SelectedProject = newProject;
         }
         if (newProject.Id == selectedProject.Id && !nodeSelected) {
@@ -471,6 +465,4 @@
 
       projectsTreeView.ExpandAll();
-
-      return selectedProject;
     }
 
@@ -485,8 +477,8 @@
 
     private void RemoveProject(Project project) {
-      if (project == null || project.Id == Guid.Empty) return;
+      if (project == null) return;
 
       try {
-        HiveAdminClient.Delete(project);
+        if(project.Id != Guid.Empty) HiveAdminClient.Delete(project);
         Content.Remove(selectedProject);
       } catch (AnonymousUserException) {
@@ -497,5 +489,4 @@
     private bool IsAuthorized(Project project) {
       return project != null && UserInformation.Instance.UserExists;
-          //&& (project.OwnerUserId == UserInformation.Instance.User.Id || HiveRoles.CheckAdminUserPermissions());
     }
 
Index: branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ResourcesView.Designer.cs
===================================================================
--- branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ResourcesView.Designer.cs	(revision 15767)
+++ branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ResourcesView.Designer.cs	(revision 15777)
@@ -157,6 +157,6 @@
       this.treeView.TabIndex = 0;
       this.treeView.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.treeSlaveGroup_ItemDrag);
+      this.treeView.MouseDown += new System.Windows.Forms.MouseEventHandler(this.treeSlaveGroup_MouseDown);
       this.treeView.BeforeSelect += new System.Windows.Forms.TreeViewCancelEventHandler(this.treeSlaveGroup_BeforeSelect);
-      this.treeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeSlaveGroup_AfterSelect);
       this.treeView.DragDrop += new System.Windows.Forms.DragEventHandler(this.treeSlaveGroup_DragDrop);
       this.treeView.DragEnter += new System.Windows.Forms.DragEventHandler(this.treeSlaveGroup_DragEnterOver);
Index: branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ResourcesView.cs
===================================================================
--- branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ResourcesView.cs	(revision 15767)
+++ branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ResourcesView.cs	(revision 15777)
@@ -45,5 +45,10 @@
     private readonly Color changedColor = Color.FromArgb(255, 87, 191, 193); // #57bfc1
     private readonly Color selectedColor = Color.FromArgb(255, 240, 194, 59); // #f0c23b
+
     private Resource selectedResource = null;
+    public Resource SelectedResource {
+      get { return selectedResource; }
+      set { if (selectedResource != value) ChangeSelectedResource(value); }
+    }
 
     private readonly object locker = new object();
@@ -94,15 +99,5 @@
         scheduleView.Content = null;
       } else {
-        var top = BuildResourceTree(Content);
-        SetEnabledStateOfControlsForSelectedResource();
-
-        viewHost.Content = top;
-        bool locked = !IsAdmin();
-        viewHost.Locked = locked;
-        scheduleView.Locked = locked;
-
-        if (top != null && top.Id == Guid.Empty) {
-          scheduleView.SetEnabledStateOfSchedule(false);
-        }
+        BuildResourceTree(Content);
       }
     }
@@ -110,5 +105,5 @@
     protected override void SetEnabledStateOfControls() {
       base.SetEnabledStateOfControls();
-      bool enabled = Content != null && !Locked && IsAdmin();
+      bool enabled = Content != null && !Locked && !ReadOnly && IsAdmin();
       btnAddGroup.Enabled = enabled;
       btnRemoveGroup.Enabled = enabled;
@@ -220,5 +215,5 @@
       };
 
-      selectedResource = group;
+      SelectedResource = group;
       Content.Add(group);
     }
@@ -282,27 +277,11 @@
     }
 
+    private void treeSlaveGroup_MouseDown(object sender, MouseEventArgs e) {
+      var node = treeView.GetNodeAt(e.Location);
+      if(node != null && node.Name != ungroupedGroupName) ChangeSelectedResourceNode(node);
+    }
+
     private void treeSlaveGroup_BeforeSelect(object sender, TreeViewCancelEventArgs e) {
-      if (((Resource)e.Node.Tag).Name == ungroupedGroupName) e.Cancel = true;
-    }
-
-    private async void treeSlaveGroup_AfterSelect(object sender, TreeViewEventArgs e) {
-      ChangeSelectedResourceNode(e.Node);
-      SetEnabledStateOfControlsForSelectedResource();
-
-      //if (viewHost.Content != null && viewHost.Content is SlaveGroup)
-      //  ((SlaveGroup)viewHost.Content).PropertyChanged -= SlaveViewContent_PropertyChanged;
-
-      viewHost.Content = selectedResource;
-      HiveAdminClient.Instance.DowntimeForResourceId = selectedResource != null ? selectedResource.Id : Guid.Empty;
-      await SecurityExceptionUtil.TryAsyncAndReportSecurityExceptions(
-        action: () => UpdateSchedule(),
-        finallyCallback: () => scheduleView.Content = HiveAdminClient.Instance.Downtimes);
-
-      //if (selectedResource != null && selectedResource is SlaveGroup)
-      //  selectedResource.PropertyChanged += SlaveViewContent_PropertyChanged;
-
-      bool locked = !IsAdmin();
-      viewHost.Locked = locked;
-      scheduleView.Locked = locked;
+      e.Cancel = true;
     }
 
@@ -321,29 +300,7 @@
       var targetNode = treeView.GetNodeAt(targetPoint);
 
-      if (sourceNode == targetNode) return;
       var targetResource = (targetNode != null) ? (Resource)targetNode.Tag : null;
 
-      if (!IsAdmin()) {
-        MessageBox.Show(
-          "You cannot drag resources. This is solely granted for HeuristicLab Hive Administrators.",
-          "HeuristicLab Hive Administrator",
-          MessageBoxButtons.OK,
-          MessageBoxIcon.Information);
-        return;
-      } else if (targetResource != null && targetResource is Slave) {
-        MessageBox.Show(
-          "You cannot drag resources on to a slave.",
-          "HeuristicLab Hive Administrator",
-          MessageBoxButtons.OK,
-          MessageBoxIcon.Information);
-        return;
-      } else if (targetResource != null && targetResource.Id == Guid.Empty) {
-        MessageBox.Show(
-          "You cannot drag resources to a not yet stored resource group.",
-          "HeuristicLab Hive Administrator",
-          MessageBoxButtons.OK,
-          MessageBoxIcon.Information);
-        return;
-      } else if(!HiveAdminClient.Instance.CheckParentChange(sourceResource, targetResource)) {
+      if(!HiveAdminClient.Instance.CheckParentChange(sourceResource, targetResource)) {
         MessageBox.Show(
           "You cannot drag resources to this group.",
@@ -352,11 +309,4 @@
           MessageBoxIcon.Information);
         return;
-      } else if (targetNode != null && (targetNode.Text == ungroupedGroupName || targetNode.Parent != null && targetNode.Parent.Text == ungroupedGroupName)) {
-        MessageBox.Show(
-          string.Format(@"You cannot drag resources to group ""{0}"". This group only contains slaves which have not been assigned to a real group yet.", ungroupedGroupName),
-          "HeuristicLab Hive Administrator",
-          MessageBoxButtons.OK,
-          MessageBoxIcon.Information);
-        return;
       }
 
@@ -375,5 +325,5 @@
       }
 
-      selectedResource = sourceResource;
+      SelectedResource = sourceResource;
       OnContentChanged();
     }
@@ -399,7 +349,4 @@
         || sourceResource == null 
         || sourceNode == targetNode
-        || (targetResource != null && targetResource is Slave)
-        || (targetResource != null && targetResource.Id == Guid.Empty)
-        || (targetResource != null && targetResource.Id == sourceResource.ParentResourceId)
         || !HiveAdminClient.Instance.CheckParentChange(sourceResource, targetResource)
         || (targetNode != null && (targetNode.Text == ungroupedGroupName || targetNode.Parent != null && targetNode.Parent.Text == ungroupedGroupName))) {
@@ -435,7 +382,7 @@
     }
 
-    private Resource BuildResourceTree(IEnumerable<Resource> resources) {
+    private void BuildResourceTree(IEnumerable<Resource> resources) {
       treeView.Nodes.Clear();
-      if (!resources.Any()) return null;
+      if (!resources.Any()) return;
 
       var mainResources = new HashSet<Resource>(resources.OfType<SlaveGroup>()
@@ -447,5 +394,5 @@
 
       var stack = new Stack<Resource>(mainResources.OrderByDescending(x => x.Name));
-      if (selectedResource != null) selectedResource = resources.Where(x => x.Id == selectedResource.Id).FirstOrDefault();
+      if (selectedResource != null) SelectedResource = resources.Where(x => x.Id == selectedResource.Id).FirstOrDefault();
       bool nodeSelected = false;
 
@@ -463,5 +410,5 @@
         }
         if (selectedResource == null) {
-          selectedResource = newResource;
+          SelectedResource = newResource;
         }
         if (newResource.Id == selectedResource.Id && !nodeSelected) {
@@ -517,5 +464,5 @@
         ungroupedNode.Nodes.Add(slaveNode);
         if(selectedResource == null) {
-          selectedResource = slave;
+          SelectedResource = slave;
         }
         if (slave.Id == Guid.Empty) {
@@ -533,6 +480,4 @@
       treeView.Nodes.Add(ungroupedNode);
       treeView.ExpandAll();
-
-      return selectedResource;
     }
 
@@ -586,8 +531,8 @@
 
     private void RemoveResource(Resource resource) {
-      if (resource == null || resource.Id == Guid.Empty) return;
+      if (resource == null) return;
 
       try {
-        HiveAdminClient.Delete(resource);
+        if(resource.Id != Guid.Empty) HiveAdminClient.Delete(resource);
         Content.Remove(selectedResource);
       } catch(AnonymousUserException) {
@@ -617,6 +562,26 @@
     }
 
+    private async void ChangeSelectedResource(Resource resource) {
+      selectedResource = resource;
+      viewHost.Content = selectedResource;
+      HiveAdminClient.Instance.DowntimeForResourceId = selectedResource != null ? selectedResource.Id : Guid.Empty;
+      await SecurityExceptionUtil.TryAsyncAndReportSecurityExceptions(
+        action: () => UpdateSchedule(),
+        finallyCallback: () => scheduleView.Content = HiveAdminClient.Instance.Downtimes);
+
+      bool locked = !IsAdmin() || resource == null;
+      bool addLocked = locked || (resource != null && resource.Id == Guid.Empty);
+
+      btnAddGroup.Enabled = !addLocked;
+      btnRemoveGroup.Enabled = !locked;
+      btnSave.Enabled = !locked;
+      viewHost.Locked = locked;
+      scheduleView.Locked = locked;
+      scheduleView.SetEnabledStateOfSchedule(!addLocked);
+    }
+
     private void ChangeSelectedResourceNode(TreeNode resourceNode) {
-      selectedResource = (Resource)resourceNode.Tag;
+      if (resourceNode == null) return;
+      SelectedResource = (Resource)resourceNode.Tag;
       ResetTreeNodes(treeView.Nodes, selectedColor, Color.Transparent, true);
       resourceNode.BackColor = selectedColor;
@@ -624,11 +589,4 @@
     }
 
-    private void SetEnabledStateOfControlsForSelectedResource() {
-      bool enabled = (IsAdmin()) ? true : false;
-      btnAddGroup.Enabled = enabled;
-      btnRemoveGroup.Enabled = enabled;
-      btnSave.Enabled = enabled;
-    }
-
     private void ShowHiveInformationDialog() {
       if (InvokeRequired) Invoke((Action)ShowHiveInformationDialog);
