Index: trunk/src/org/openstreetmap/josm/Main.java
===================================================================
--- trunk/src/org/openstreetmap/josm/Main.java	(revision 11092)
+++ trunk/src/org/openstreetmap/josm/Main.java	(revision 11093)
@@ -77,5 +77,4 @@
 import org.openstreetmap.josm.gui.ProgramArguments.Option;
 import org.openstreetmap.josm.gui.io.SaveLayersDialog;
-import org.openstreetmap.josm.gui.layer.AbstractModifiableLayer;
 import org.openstreetmap.josm.gui.layer.Layer;
 import org.openstreetmap.josm.gui.layer.MainLayerManager;
@@ -795,67 +794,14 @@
 
     /**
-     * Asks user to perform "save layer" operations (save on disk and/or upload data to server) for all
-     * {@link AbstractModifiableLayer} before JOSM exits.
-     * @return {@code true} if there was nothing to save, or if the user wants to proceed to save operations.
-     *         {@code false} if the user cancels.
-     * @since 2025
-     */
-    public static boolean saveUnsavedModifications() {
-        if (!isDisplayingMapView()) return true;
-        return saveUnsavedModifications(getLayerManager().getLayersOfType(AbstractModifiableLayer.class), true);
-    }
-
-    /**
-     * Asks user to perform "save layer" operations (save on disk and/or upload data to server) before data layers deletion.
-     *
-     * @param selectedLayers The layers to check. Only instances of {@link AbstractModifiableLayer} are considered.
-     * @param exit {@code true} if JOSM is exiting, {@code false} otherwise.
-     * @return {@code true} if there was nothing to save, or if the user wants to proceed to save operations.
-     *         {@code false} if the user cancels.
-     * @since 5519
-     */
-    public static boolean saveUnsavedModifications(Iterable<? extends Layer> selectedLayers, boolean exit) {
-        SaveLayersDialog dialog = new SaveLayersDialog(parent);
-        List<AbstractModifiableLayer> layersWithUnmodifiedChanges = new ArrayList<>();
-        for (Layer l: selectedLayers) {
-            if (!(l instanceof AbstractModifiableLayer)) {
-                continue;
-            }
-            AbstractModifiableLayer odl = (AbstractModifiableLayer) l;
-            if (odl.isModified() &&
-                    ((!odl.isSavable() && !odl.isUploadable()) ||
-                     odl.requiresSaveToFile() ||
-                     (odl.requiresUploadToServer() && !odl.isUploadDiscouraged()))) {
-                layersWithUnmodifiedChanges.add(odl);
-            }
-        }
-        if (exit) {
-            dialog.prepareForSavingAndUpdatingLayersBeforeExit();
-        } else {
-            dialog.prepareForSavingAndUpdatingLayersBeforeDelete();
-        }
-        if (!layersWithUnmodifiedChanges.isEmpty()) {
-            dialog.getModel().populate(layersWithUnmodifiedChanges);
-            dialog.setVisible(true);
-            switch(dialog.getUserAction()) {
-            case PROCEED: return true;
-            case CANCEL:
-            default: return false;
-            }
-        }
-
-        return true;
-    }
-
-    /**
      * Closes JOSM and optionally terminates the Java Virtual Machine (JVM).
      * If there are some unsaved data layers, asks first for user confirmation.
      * @param exit If {@code true}, the JVM is terminated by running {@link System#exit} with a given return code.
      * @param exitCode The return code
+     * @param reason the reason for exiting
      * @return {@code true} if JOSM has been closed, {@code false} if the user has cancelled the operation.
-     * @since 3378
-     */
-    public static boolean exitJosm(boolean exit, int exitCode) {
-        if (Main.saveUnsavedModifications()) {
+     * @since 11093 (3378 with a different function signature)
+     */
+    public static boolean exitJosm(boolean exit, int exitCode, SaveLayersDialog.Reason reason) {
+        if (SaveLayersDialog.saveUnsavedModifications(getLayerManager().getLayers(), reason != null ? reason : SaveLayersDialog.Reason.EXIT)) {
             if (Main.main != null) {
                 Main.main.shutdown();
Index: trunk/src/org/openstreetmap/josm/actions/DeleteLayerAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/DeleteLayerAction.java	(revision 11092)
+++ trunk/src/org/openstreetmap/josm/actions/DeleteLayerAction.java	(revision 11093)
@@ -10,4 +10,5 @@
 
 import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.gui.io.SaveLayersDialog;
 import org.openstreetmap.josm.gui.layer.Layer;
 import org.openstreetmap.josm.tools.Shortcut;
@@ -34,5 +35,5 @@
             return;
         }
-        if (!Main.saveUnsavedModifications(Collections.singletonList(activeLayer), false)) {
+        if (!SaveLayersDialog.saveUnsavedModifications(Collections.singletonList(activeLayer), SaveLayersDialog.Reason.DELETE)) {
             return;
         }
Index: trunk/src/org/openstreetmap/josm/actions/ExitAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/ExitAction.java	(revision 11092)
+++ trunk/src/org/openstreetmap/josm/actions/ExitAction.java	(revision 11093)
@@ -28,5 +28,5 @@
     @Override
     public void actionPerformed(ActionEvent e) {
-        Main.exitJosm(true, 0);
+        Main.exitJosm(true, 0, null);
     }
 }
Index: trunk/src/org/openstreetmap/josm/actions/RestartAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/RestartAction.java	(revision 11092)
+++ trunk/src/org/openstreetmap/josm/actions/RestartAction.java	(revision 11093)
@@ -17,4 +17,5 @@
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec;
+import org.openstreetmap.josm.gui.io.SaveLayersDialog;
 import org.openstreetmap.josm.tools.ImageProvider;
 import org.openstreetmap.josm.tools.Shortcut;
@@ -59,5 +60,5 @@
         String scriptRestart = System.getProperty("josm.restart");
         if ("true".equals(scriptRestart)) {
-            Main.exitJosm(true, 9);
+            Main.exitJosm(true, 9, SaveLayersDialog.Reason.RESTART);
         }
 
@@ -83,5 +84,5 @@
      */
     public static void restartJOSM() throws IOException {
-        if (isRestartSupported() && !Main.exitJosm(false, 0)) return;
+        if (isRestartSupported() && !Main.exitJosm(false, 0, SaveLayersDialog.Reason.RESTART)) return;
         final List<String> cmd;
         // special handling for OSX .app package
Index: trunk/src/org/openstreetmap/josm/gui/MainFrame.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/MainFrame.java	(revision 11092)
+++ trunk/src/org/openstreetmap/josm/gui/MainFrame.java	(revision 11093)
@@ -92,5 +92,5 @@
             @Override
             public void windowClosing(final WindowEvent evt) {
-                Main.exitJosm(true, 0);
+                Main.exitJosm(true, 0, null);
             }
         });
Index: trunk/src/org/openstreetmap/josm/gui/dialogs/layer/DeleteLayerAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/layer/DeleteLayerAction.java	(revision 11092)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/layer/DeleteLayerAction.java	(revision 11093)
@@ -11,8 +11,8 @@
 import javax.swing.JMenuItem;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.gui.dialogs.IEnabledStateUpdating;
 import org.openstreetmap.josm.gui.dialogs.LayerListDialog.LayerListModel;
 import org.openstreetmap.josm.gui.help.HelpUtil;
+import org.openstreetmap.josm.gui.io.SaveLayersDialog;
 import org.openstreetmap.josm.gui.layer.Layer;
 import org.openstreetmap.josm.gui.layer.Layer.LayerAction;
@@ -44,5 +44,5 @@
         if (selectedLayers.isEmpty())
             return;
-        if (!Main.saveUnsavedModifications(selectedLayers, false))
+        if (!SaveLayersDialog.saveUnsavedModifications(selectedLayers, SaveLayersDialog.Reason.DELETE))
             return;
         for (Layer l: selectedLayers) {
Index: trunk/src/org/openstreetmap/josm/gui/io/SaveLayersDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/io/SaveLayersDialog.java	(revision 11092)
+++ trunk/src/org/openstreetmap/josm/gui/io/SaveLayersDialog.java	(revision 11093)
@@ -19,4 +19,5 @@
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.CancellationException;
@@ -47,4 +48,5 @@
 import org.openstreetmap.josm.gui.io.SaveLayersModel.Mode;
 import org.openstreetmap.josm.gui.layer.AbstractModifiableLayer;
+import org.openstreetmap.josm.gui.layer.Layer;
 import org.openstreetmap.josm.gui.progress.ProgressMonitor;
 import org.openstreetmap.josm.gui.progress.SwingRenderingProgressMonitor;
@@ -58,5 +60,18 @@
 
 public class SaveLayersDialog extends JDialog implements TableModelListener {
-    public enum UserAction {
+
+    /**
+     * The cause for requesting an action on unsaved modifications
+     */
+    public enum Reason {
+        /** deleting a layer */
+        DELETE,
+        /** exiting JOSM */
+        EXIT,
+        /* restarting JOSM */
+        RESTART
+    }
+
+    private enum UserAction {
         /** save/upload layers was successful, proceed with operation */
         PROCEED,
@@ -76,4 +91,42 @@
 
     private final JButton saveAndProceedActionButton = new JButton(saveAndProceedAction);
+
+    /**
+     * Asks user to perform "save layer" operations (save on disk and/or upload data to server) before data layers deletion.
+     *
+     * @param selectedLayers The layers to check. Only instances of {@link AbstractModifiableLayer} are considered.
+     * @param reason the cause for requesting an action on unsaved modifications
+     * @return {@code true} if there was nothing to save, or if the user wants to proceed to save operations.
+     *         {@code false} if the user cancels.
+     * @since 11093
+     */
+    public static boolean saveUnsavedModifications(Iterable<? extends Layer> selectedLayers, Reason reason) {
+        SaveLayersDialog dialog = new SaveLayersDialog(Main.parent);
+        List<AbstractModifiableLayer> layersWithUnmodifiedChanges = new ArrayList<>();
+        for (Layer l: selectedLayers) {
+            if (!(l instanceof AbstractModifiableLayer)) {
+                continue;
+            }
+            AbstractModifiableLayer odl = (AbstractModifiableLayer) l;
+            if (odl.isModified() &&
+                    ((!odl.isSavable() && !odl.isUploadable()) ||
+                            odl.requiresSaveToFile() ||
+                            (odl.requiresUploadToServer() && !odl.isUploadDiscouraged()))) {
+                layersWithUnmodifiedChanges.add(odl);
+            }
+        }
+        dialog.prepareForSavingAndUpdatingLayers(reason);
+        if (!layersWithUnmodifiedChanges.isEmpty()) {
+            dialog.getModel().populate(layersWithUnmodifiedChanges);
+            dialog.setVisible(true);
+            switch(dialog.getUserAction()) {
+                case PROCEED: return true;
+                case CANCEL:
+                default: return false;
+            }
+        }
+
+        return true;
+    }
 
     /**
@@ -131,14 +184,18 @@
     }
 
-    public void prepareForSavingAndUpdatingLayersBeforeExit() {
-        setTitle(tr("Unsaved changes - Save/Upload before exiting?"));
-        this.saveAndProceedAction.initForSaveAndExit();
-        this.discardAndProceedAction.initForDiscardAndExit();
-    }
-
-    public void prepareForSavingAndUpdatingLayersBeforeDelete() {
-        setTitle(tr("Unsaved changes - Save/Upload before deleting?"));
-        this.saveAndProceedAction.initForSaveAndDelete();
-        this.discardAndProceedAction.initForDiscardAndDelete();
+    public void prepareForSavingAndUpdatingLayers(final Reason reason) {
+        switch (reason) {
+            case EXIT:
+                setTitle(tr("Unsaved changes - Save/Upload before exiting?"));
+                break;
+            case DELETE:
+                setTitle(tr("Unsaved changes - Save/Upload before deleting?"));
+                break;
+            case RESTART:
+                setTitle(tr("Unsaved changes - Save/Upload before restarting?"));
+                break;
+        }
+        this.saveAndProceedAction.initForReason(reason);
+        this.discardAndProceedAction.initForReason(reason);
     }
 
@@ -323,17 +380,26 @@
     class DiscardAndProceedAction extends AbstractAction implements PropertyChangeListener {
         DiscardAndProceedAction() {
-            initForDiscardAndExit();
-        }
-
-        public void initForDiscardAndExit() {
-            putValue(NAME, tr("Exit now!"));
-            putValue(SHORT_DESCRIPTION, tr("Exit JOSM without saving. Unsaved changes are lost."));
-            putValue(SMALL_ICON, ImageProvider.get("exit"));
-        }
-
-        public void initForDiscardAndDelete() {
-            putValue(NAME, tr("Delete now!"));
-            putValue(SHORT_DESCRIPTION, tr("Delete layers without saving. Unsaved changes are lost."));
-            putValue(SMALL_ICON, ImageProvider.get("dialogs", "delete"));
+            initForReason(Reason.EXIT);
+        }
+
+        public void initForReason(Reason reason) {
+            switch (reason) {
+                case EXIT:
+                    putValue(NAME, tr("Exit now!"));
+                    putValue(SHORT_DESCRIPTION, tr("Exit JOSM without saving. Unsaved changes are lost."));
+                    putValue(SMALL_ICON, ImageProvider.get("exit"));
+                    break;
+                case RESTART:
+                    putValue(NAME, tr("Restart now!"));
+                    putValue(SHORT_DESCRIPTION, tr("Restart JOSM without saving. Unsaved changes are lost."));
+                    putValue(SMALL_ICON, ImageProvider.get("restart"));
+                    break;
+                case DELETE:
+                    putValue(NAME, tr("Delete now!"));
+                    putValue(SHORT_DESCRIPTION, tr("Delete layers without saving. Unsaved changes are lost."));
+                    putValue(SMALL_ICON, ImageProvider.get("dialogs", "delete"));
+                    break;
+            }
+
         }
 
@@ -385,18 +451,25 @@
 
         SaveAndProceedAction() {
-            initForSaveAndExit();
-        }
-
-        public void initForSaveAndExit() {
-            putValue(NAME, tr("Perform actions before exiting"));
-            putValue(SHORT_DESCRIPTION, tr("Exit JOSM with saving. Unsaved changes are uploaded and/or saved."));
-            putValue(BASE_ICON, ImageProvider.get("exit"));
-            redrawIcon();
-        }
-
-        public void initForSaveAndDelete() {
-            putValue(NAME, tr("Perform actions before deleting"));
-            putValue(SHORT_DESCRIPTION, tr("Save/Upload layers before deleting. Unsaved changes are not lost."));
-            putValue(BASE_ICON, ImageProvider.get("dialogs", "delete"));
+            initForReason(Reason.EXIT);
+        }
+
+        public void initForReason(Reason reason) {
+            switch (reason) {
+                case EXIT:
+                    putValue(NAME, tr("Perform actions before exiting"));
+                    putValue(SHORT_DESCRIPTION, tr("Exit JOSM with saving. Unsaved changes are uploaded and/or saved."));
+                    putValue(BASE_ICON, ImageProvider.get("exit"));
+                    break;
+                case RESTART:
+                    putValue(NAME, tr("Perform actions before restarting"));
+                    putValue(SHORT_DESCRIPTION, tr("Restart JOSM with saving. Unsaved changes are uploaded and/or saved."));
+                    putValue(BASE_ICON, ImageProvider.get("restart"));
+                    break;
+                case DELETE:
+                    putValue(NAME, tr("Perform actions before deleting"));
+                    putValue(SHORT_DESCRIPTION, tr("Save/Upload layers before deleting. Unsaved changes are not lost."));
+                    putValue(BASE_ICON, ImageProvider.get("dialogs", "delete"));
+                    break;
+            }
             redrawIcon();
         }
Index: trunk/src/org/openstreetmap/josm/tools/PlatformHookOsx.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/PlatformHookOsx.java	(revision 11092)
+++ trunk/src/org/openstreetmap/josm/tools/PlatformHookOsx.java	(revision 11093)
@@ -145,5 +145,5 @@
             break;
         case "handleQuitRequestWith":
-            boolean closed = Main.exitJosm(false, 0);
+            boolean closed = Main.exitJosm(false, 0, null);
             if (args[1] != null) {
                 try {
