void ISISDiagnostics::handleNewFile() {
  if (!m_uiForm.dsInputFiles->isValid())
    return;

  QString filename = m_uiForm.dsInputFiles->getFirstFilename();

  QFileInfo fi(filename);
  QString wsname = fi.baseName();

  int specMin = static_cast<int>(m_dblManager->value(m_properties["SpecMin"]));
  int specMax = static_cast<int>(m_dblManager->value(m_properties["SpecMax"]));

  if (!loadFile(filename, wsname, specMin, specMax)) {
    emit showMessageBox("Unable to load file.\nCheck whether your file exists "
                        "and matches the selected instrument in the "
                        "EnergyTransfer tab.");
    return;
  }

  Mantid::API::MatrixWorkspace_sptr input =
      boost::dynamic_pointer_cast<Mantid::API::MatrixWorkspace>(
          Mantid::API::AnalysisDataService::Instance().retrieve(
              wsname.toStdString()));

  const auto &dataX = input->x(0);
  QPair<double, double> range(dataX.front(), dataX.back());
  int previewSpec =
      static_cast<int>(m_dblManager->value(m_properties["PreviewSpec"])) -
      specMin;

  m_uiForm.ppRawPlot->clear();
  m_uiForm.ppRawPlot->addSpectrum("Raw", input, previewSpec);

  setPlotPropertyRange(m_uiForm.ppRawPlot->getRangeSelector("SlicePeak"),
                       m_properties["PeakStart"], m_properties["PeakEnd"],
                       range);
  setPlotPropertyRange(m_uiForm.ppRawPlot->getRangeSelector("SliceBackground"),
                       m_properties["BackgroundStart"],
                       m_properties["BackgroundEnd"], range);

  m_uiForm.ppRawPlot->resizeX();
}