--- src/core/org/apache/jmeter/gui/action/Restart.java (revision 1839171) +++ src/core/org/apache/jmeter/gui/action/Restart.java (working copy) @@ -65,7 +65,23 @@ @Override public void doAction(ActionEvent e) { try { - restartApplication(null); + ActionRouter.getInstance().doActionNow(new ActionEvent(e.getSource(), e.getID(), ActionNames.CHECK_DIRTY)); + if (GuiPackage.getInstance().isDirty()) { + int chosenOption = JOptionPane.showConfirmDialog(GuiPackage.getInstance().getMainFrame(), JMeterUtils + .getResString("cancel_exit_to_save"), // $NON-NLS-1$ + JMeterUtils.getResString("save?"), // $NON-NLS-1$ + JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); + if (chosenOption == JOptionPane.NO_OPTION) { + restartApplication(null); + } else if (chosenOption == JOptionPane.YES_OPTION) { + ActionRouter.getInstance().doActionNow(new ActionEvent(e.getSource(), e.getID(), ActionNames.SAVE)); + if (!GuiPackage.getInstance().isDirty()) { + restartApplication(null); + } + } + } else { + restartApplication(null); + } } catch (Exception ex) { log.error("Error trying to restart: {}", ex.getMessage(), ex); JOptionPane.showMessageDialog(GuiPackage.getInstance().getMainFrame(),