Index: trunk/sources/HeuristicLab.MainForm/3.2/DockingMainForm.cs
===================================================================
--- trunk/sources/HeuristicLab.MainForm/3.2/DockingMainForm.cs	(revision 2305)
+++ trunk/sources/HeuristicLab.MainForm/3.2/DockingMainForm.cs	(revision 2306)
@@ -45,46 +45,23 @@
       if (InvokeRequired) Invoke((Action<IView>)ShowView, view);
       else {
-        base.ShowView(view);
-        DockContent dockForm = new DockForm(view);
-        dockForm.Activated += new EventHandler(DockFormActivated);
-        dockForm.FormClosing += new FormClosingEventHandler(view.FormClosing);
-        dockForm.FormClosed += new FormClosedEventHandler(DockFormClosed);
-        foreach (IToolStripItem item in ToolStripItems)
-          view.StateChanged += new EventHandler(item.ViewChanged);
-        dockForm.Show(dockPanel);
+        if (views.Contains(view)) {
+          DockForm dockform = FindForm(view);
+          if (dockform != null)
+            dockform.Activate();
+        } else {
+          base.ShowView(view);
+          DockContent dockForm = new DockForm(view);
+          dockForm.Activated += new EventHandler(DockFormActivated);
+          dockForm.FormClosing += new FormClosingEventHandler(view.FormClosing);
+          dockForm.FormClosed += new FormClosedEventHandler(DockFormClosed);
+          foreach (IToolStripItem item in ToolStripItems)
+            view.StateChanged += new EventHandler(item.ViewChanged);
+          dockForm.Show(dockPanel);
+        }
       }
     }
 
     public override void CloseView(IView view) {
-      DockForm dockform = null;
-      IEnumerable<DockForm> dockforms;
-
-      if (dockPanel.Documents.Count() != 0) {
-        dockforms = dockPanel.Documents.Cast<DockForm>().Where(df => df.View == view);
-        if (dockforms.Count() == 1)
-          dockform = dockforms.Single();
-      }
-      if (dockPanel.FloatWindows.Count() != 0) {
-        foreach (FloatWindow fw in dockPanel.FloatWindows) {
-          foreach (DockContentCollection dc in fw.NestedPanes.Select(np => np.Contents)) {
-            dockforms = dc.Cast<DockForm>().Where(df => df.View == view);
-            if (dockforms.Count() == 1) {
-              dockform = dockforms.Single();
-              break;
-            }
-          }
-        }
-      }
-      if (dockPanel.DockWindows.Count != 0) {
-        foreach (DockWindow dw in dockPanel.DockWindows) {
-          foreach (DockContentCollection dc in dw.NestedPanes.Select(np => np.Contents)) {
-            dockforms = dc.Cast<DockForm>().Where(df => df.View == view);
-            if (dockforms.Count() == 1) {
-              dockform = dockforms.Single();
-              break;
-            }
-          }
-        }
-      }
+      DockForm dockform = FindForm(view);
       if (dockform != null)
         dockform.Close();
@@ -108,4 +85,33 @@
       base.ActiveView = ((DockForm)sender).View;
     }
+
+    protected DockForm FindForm(IView view) {
+      IEnumerable<DockForm> dockforms;
+
+      if (dockPanel.Documents.Count() != 0) {
+        dockforms = dockPanel.Documents.Cast<DockForm>().Where(df => df.View == view);
+        if (dockforms.Count() == 1)
+          return dockforms.Single();
+      }
+      if (dockPanel.FloatWindows.Count() != 0) {
+        foreach (FloatWindow fw in dockPanel.FloatWindows) {
+          foreach (DockContentCollection dc in fw.NestedPanes.Select(np => np.Contents)) {
+            dockforms = dc.Cast<DockForm>().Where(df => df.View == view);
+            if (dockforms.Count() == 1)
+              return dockforms.Single();
+          }
+        }
+      }
+      if (dockPanel.DockWindows.Count != 0) {
+        foreach (DockWindow dw in dockPanel.DockWindows) {
+          foreach (DockContentCollection dc in dw.NestedPanes.Select(np => np.Contents)) {
+            dockforms = dc.Cast<DockForm>().Where(df => df.View == view);
+            if (dockforms.Count() == 1)
+              return dockforms.Single();
+          }
+        }
+      }
+      return null;
+    }
   }
 }
