QWidget* SpectralLibraryMatchResults::createWidget()
{
   mpTabWidget = new QTabWidget(getDockWindow()->getWidget());
   mpTabWidget->setTabPosition(QTabWidget::South);
   mpTabWidget->setTabShape(QTabWidget::Rounded);
   mpTabWidget->setMinimumHeight(100);

   // dockwindow should exist so attach to it
   DockWindow* pWindow = getDockWindow();
   if (pWindow != NULL)
   {

      pWindow->attach(SIGNAL_NAME(DockWindow, AboutToShowContextMenu),
         Slot(this, &SpectralLibraryMatchResults::updateContextMenu));

      // Connect to the session explorer now that the window has been created
      if (mpExplorer.get() == NULL)
      {
         Service<SessionExplorer> pExplorer;
         mpExplorer.reset(pExplorer.get());
      }

      // set location of the results window
#pragma message(__FILE__ "(" STRING(__LINE__) ") : warning : Replace this block when public method to locate DockWindow is available. (rforehan)")
      QMainWindow* pMainWindow = dynamic_cast<QMainWindow*>(Service<DesktopServices>()->getMainWidget());
      if (pMainWindow != NULL)
      {
         pMainWindow->addDockWidget(Qt::LeftDockWidgetArea, dynamic_cast<QDockWidget*>(pWindow), Qt::Vertical);
      }     
   }

   return mpTabWidget;
}
QWidget* RangeProfilePlotManager::createWidget()
{
   DockWindow* pWindow = getDockWindow();
   VERIFYRV(pWindow, NULL);
   pWindow->attach(SIGNAL_NAME(Window, SessionItemDropped), Slot(this, &RangeProfilePlotManager::dropSessionItem));
   pWindow->enableSessionItemDrops(this);
   if (!Service<SessionManager>()->isSessionLoading())
   {
      mpPlot = Service<DesktopServices>()->createPlotWidget(getName(), CARTESIAN_PLOT);
   }
   if (mpPlot == NULL)
   {
      return NULL;
   }
   mpView = mpPlot->getPlot();
#pragma message(__FILE__ "(" STRING(__LINE__) ") : warning : If a SHALLOW_SELECTION selection mode is added " \
                                              "to plot view (OPTICKS-528), mpView should use it (tclarke)")
   mpMode = (mpView == NULL) ? NULL : mpView->getMouseMode("SelectionMode");
   if (mpMode == NULL)
   {
      return NULL;
   }
   mpView->getWidget()->installEventFilter(this);
   mpPlot->attach(SIGNAL_NAME(PlotWidget, AboutToShowContextMenu),
      Slot(this, &RangeProfilePlotManager::updateContextMenu));
   mpView->enableMouseMode(mpMode, true);
   mpView->setMouseMode(mpMode);

   return mpPlot->getWidget();
}