From ac955658ea8d3905e1a6bd0466bc735e8ee4ea9e Mon Sep 17 00:00:00 2001
From: Tom Perkins <thomas.perkins@stfc.ac.uk>
Date: Thu, 14 Jan 2016 13:12:12 +0000
Subject: [PATCH] Re #14739 Block plot surface/contour if multiple groups
 selected

These options should only be shown on the right-click menu if a single
WorkspaceGroup has been clicked on. If multiple groups are selected, do
not show the options.
---
 MantidPlot/src/Mantid/MantidDock.cpp | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/MantidPlot/src/Mantid/MantidDock.cpp b/MantidPlot/src/Mantid/MantidDock.cpp
index 7d05ccfe8fb..43114c623d3 100644
--- a/MantidPlot/src/Mantid/MantidDock.cpp
+++ b/MantidPlot/src/Mantid/MantidDock.cpp
@@ -651,16 +651,21 @@ void MantidDockWidget::addWorkspaceGroupMenuItems(
   m_colorFill->setEnabled(true);
 
   // If appropriate, add "plot surface" and "plot contour" options
-  // Only add these if there are >2 workspaces in group, and all are
-  // MatrixWorkspaces (otherwise they can't be plotted)
-  if (groupWS && groupWS->getNumberOfEntries() > 2) {
-    if (MantidGroupPlotGenerator::groupIsAllMatrixWorkspaces(groupWS)) {
-      menu->addAction(m_plotSurface);
-      m_plotSurface->setEnabled(true);
-      menu->addAction(m_plotContour);
-      m_plotContour->setEnabled(true);
+  // Only add these if:
+  // - there are >2 workspaces in group
+  // - all are MatrixWorkspaces (otherwise they can't be plotted)
+  // - only one group is selected
+  if (m_tree->selectedItems().size() == 1) {
+    if (groupWS && groupWS->getNumberOfEntries() > 2) {
+      if (MantidGroupPlotGenerator::groupIsAllMatrixWorkspaces(groupWS)) {
+        menu->addAction(m_plotSurface);
+        m_plotSurface->setEnabled(true);
+        menu->addAction(m_plotContour);
+        m_plotContour->setEnabled(true);
+      }
     }
   }
+
   menu->addSeparator();
   menu->addAction(m_saveNexus);
 }
-- 
GitLab