Bug 2213 - User is not prompted to save when debug session is started
authorEugene Ostroukhov <eugeneo@symbian.org>
Mon, 15 Mar 2010 17:56:08 -0700
changeset 268 ef733cd772bb
parent 267 a0f8d02facf1
child 269 2c88d577a0e9
Bug 2213 - User is not prompted to save when debug session is started
org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/launch/WidgetLaunchDelegate.java
--- a/org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/launch/WidgetLaunchDelegate.java	Mon Mar 15 17:36:40 2010 -0700
+++ b/org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/launch/WidgetLaunchDelegate.java	Mon Mar 15 17:56:08 2010 -0700
@@ -32,6 +32,9 @@
 import org.eclipse.debug.core.ILaunchConfiguration;
 import org.eclipse.debug.core.ILaunchManager;
 import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
 import org.symbian.tools.wrttools.debug.internal.Activator;
 import org.symbian.tools.wrttools.debug.internal.IConstants;
 import org.symbian.tools.wrttools.previewer.PreviewerPlugin;
@@ -43,6 +46,18 @@
 			throws CoreException {
 		monitor.beginTask("Preparing WRT Debugger", IProgressMonitor.UNKNOWN);
 		ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
+        final IWorkbench workbench = PlatformUI.getWorkbench();
+        final IWorkbenchWindow window = workbench.getWorkbenchWindows()[0];
+        final boolean[] retvalue = new boolean[1];
+        window.getShell().getDisplay().syncExec(new Runnable() {
+            public void run() {
+                retvalue[0] = workbench.saveAllEditors(true);
+            }
+        });
+        if (!retvalue[0]) {
+            launchManager.removeLaunch(launch);
+            return;
+        }
 		boolean debug = mode.equals(ILaunchManager.DEBUG_MODE);
 		try {
 			// 1. Load all parameters