Index: branches/2845_EnhancedProgress/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionVariableImpactsView.cs
===================================================================
--- branches/2845_EnhancedProgress/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionVariableImpactsView.cs	(revision 16307)
+++ branches/2845_EnhancedProgress/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionVariableImpactsView.cs	(revision 16308)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -19,10 +19,7 @@
  */
 #endregion
-
 using System;
-using System.Collections.Generic;
 using System.Linq;
 using System.Threading.Tasks;
-using HeuristicLab.Common;
 using HeuristicLab.Data;
 using HeuristicLab.MainForm;
@@ -32,11 +29,4 @@
   [Content(typeof(IRegressionSolution))]
   public partial class RegressionSolutionVariableImpactsView : DataAnalysisSolutionEvaluationView {
-    private enum SortingCriteria {
-      ImpactValue,
-      Occurrence,
-      VariableName
-    }
-
-    private Dictionary<string, double> rawVariableImpacts = new Dictionary<string, double>();
 
     public new IRegressionSolution Content {
@@ -50,9 +40,4 @@
       : base() {
       InitializeComponent();
-
-      //Little workaround. If you fill the ComboBox-Items in the other partial class, the UI-Designer will moan.
-      this.sortByComboBox.Items.AddRange(Enum.GetValues(typeof(SortingCriteria)).Cast<object>().ToArray());
-      this.sortByComboBox.SelectedItem = SortingCriteria.ImpactValue;
-
       this.dataPartitionComboBox.SelectedIndex = 0;
       this.replacementComboBox.SelectedIndex = 0;
@@ -90,4 +75,33 @@
     }
 
+    private void UpdateVariableImpacts() {
+      if (Content == null || replacementComboBox.SelectedIndex < 0
+        || factorVarReplComboBox.SelectedIndex < 0
+        || dataPartitionComboBox.SelectedIndex < 0) return;
+      variableImactsArrayView.Caption = Content.Name + " Variable Impacts";
+      var replMethod =
+         (RegressionSolutionVariableImpactsCalculator.ReplacementMethodEnum)
+           replacementComboBox.Items[replacementComboBox.SelectedIndex];
+      var factorReplMethod =
+        (RegressionSolutionVariableImpactsCalculator.FactorReplacementMethodEnum)
+          factorVarReplComboBox.Items[factorVarReplComboBox.SelectedIndex];
+      var dataPartition =
+        (RegressionSolutionVariableImpactsCalculator.DataPartitionEnum)dataPartitionComboBox.SelectedItem;
+
+      Task.Factory.StartNew(() => {
+        try {
+          Progress.ShowMarquee(this, "Calculating variable impacts for " + Content.Name);
+
+          var impacts = RegressionSolutionVariableImpactsCalculator.CalculateImpacts(Content, dataPartition, replMethod, factorReplMethod);
+          var impactArray = new DoubleArray(impacts.Select(i => i.Item2).ToArray());
+          impactArray.ElementNames = impacts.Select(i => i.Item1);
+          variableImactsArrayView.Content = (DoubleArray)impactArray.AsReadOnly();
+        } finally {
+          Progress.Hide(this);
+        }
+      });
+    }
+
+    #endregion
 
     private void dataPartitionComboBox_SelectedIndexChanged(object sender, EventArgs e) {
@@ -98,102 +112,4 @@
       UpdateVariableImpacts();
     }
-
-    private void sortByComboBox_SelectedIndexChanged(object sender, EventArgs e) {
-      //Update the default ordering (asc,desc), but remove the eventHandler beforehand (otherwise the data would be ordered twice)
-      ascendingCheckBox.CheckedChanged -= ascendingCheckBox_CheckedChanged;
-      switch ((SortingCriteria)sortByComboBox.SelectedItem) {
-        case SortingCriteria.ImpactValue:
-          ascendingCheckBox.Checked = false;
-          break;
-        case SortingCriteria.Occurrence:
-          ascendingCheckBox.Checked = true;
-          break;
-        case SortingCriteria.VariableName:
-          ascendingCheckBox.Checked = true;
-          break;
-        default:
-          throw new NotImplementedException("Ordering for selected SortingCriteria not implemented");
-      }
-      ascendingCheckBox.CheckedChanged += ascendingCheckBox_CheckedChanged;
-
-      UpdateDataOrdering();
-    }
-
-    private void ascendingCheckBox_CheckedChanged(object sender, EventArgs e) {
-      UpdateDataOrdering();
-    }
-    #endregion
-
-    #region Helper Methods         
-    private void UpdateVariableImpacts() {
-      if (Content == null) { return; }
-      if (replacementComboBox.SelectedIndex < 0) { return; }
-      if (dataPartitionComboBox.SelectedIndex < 0) { return; }
-      if (factorVarReplComboBox.SelectedIndex < 0) { return; }
-
-      variableImactsArrayView.Caption = Content.Name + " Variable Impacts";
-
-      var mainForm = (MainForm.WindowsForms.MainForm)MainFormManager.MainForm;
-      var replMethod = (RegressionSolutionVariableImpactsCalculator.ReplacementMethodEnum)replacementComboBox.Items[replacementComboBox.SelectedIndex];
-      var factorReplMethod = (RegressionSolutionVariableImpactsCalculator.FactorReplacementMethodEnum)factorVarReplComboBox.Items[factorVarReplComboBox.SelectedIndex];
-      var dataPartition = (RegressionSolutionVariableImpactsCalculator.DataPartitionEnum)dataPartitionComboBox.SelectedItem;
-
-      Task.Factory.StartNew(() => {
-        try {
-          Progress.ShowMarquee(this, "Calculating variable impacts for " + Content.Name);
-
-          //Remember the original ordering of the variables
-          var impacts = RegressionSolutionVariableImpactsCalculator.CalculateImpacts(Content, dataPartition, replMethod, factorReplMethod);
-          var problemData = Content.ProblemData;
-          var inputvariables = new HashSet<string>(problemData.AllowedInputVariables.Union(Content.Model.VariablesUsedForPrediction));
-          var originalVariableOrdering = problemData.Dataset.VariableNames.Where(v => inputvariables.Contains(v)).Where(problemData.Dataset.VariableHasType<double>).ToList();
-          rawVariableImpacts.Clear();
-          originalVariableOrdering.ForEach(v => rawVariableImpacts.Add(v, impacts.First(vv => vv.Item1 == v).Item2));
-          UpdateDataOrdering();
-        } finally {
-          Progress.Hide(this);
-        }
-      });
-    }
-
-    /// <summary>
-    /// Updates the <see cref="variableImactsArrayView"/> according to the selected ordering <see cref="ascendingCheckBox"/> of the selected Column <see cref="sortByComboBox"/>
-    /// The default is "Descending" by "VariableImpact" (as in previous versions)
-    /// </summary>
-    private void UpdateDataOrdering() {
-      //Check if valid sortingCriteria is selected and data exists
-      if (sortByComboBox.SelectedIndex == -1) { return; }
-      if (rawVariableImpacts == null) { return; }
-      if (!rawVariableImpacts.Any()) { return; }
-
-      var selectedItem = (SortingCriteria)sortByComboBox.SelectedItem;
-      bool ascending = ascendingCheckBox.Checked;
-
-      IEnumerable<KeyValuePair<string, double>> orderedEntries = null;
-
-      //Sort accordingly
-      switch (selectedItem) {
-        case SortingCriteria.ImpactValue:
-          orderedEntries = rawVariableImpacts.OrderBy(v => v.Value);
-          break;
-        case SortingCriteria.Occurrence:
-          orderedEntries = rawVariableImpacts;
-          break;
-        case SortingCriteria.VariableName:
-          orderedEntries = rawVariableImpacts.OrderBy(v => v.Key, new NaturalStringComparer());
-          break;
-        default:
-          throw new NotImplementedException("Ordering for selected SortingCriteria not implemented");
-      }
-
-      if (!ascending) { orderedEntries = orderedEntries.Reverse(); }
-
-      //Write the data back
-      var impactArray = new DoubleArray(orderedEntries.Select(i => i.Value).ToArray()) {
-        ElementNames = orderedEntries.Select(i => i.Key)
-      };
-      variableImactsArrayView.Content = (DoubleArray)impactArray.AsReadOnly();
-    }
-    #endregion
   }
 }
