30 import org.eclipse.debug.core.DebugPlugin; |
30 import org.eclipse.debug.core.DebugPlugin; |
31 import org.eclipse.debug.core.ILaunch; |
31 import org.eclipse.debug.core.ILaunch; |
32 import org.eclipse.debug.core.ILaunchConfiguration; |
32 import org.eclipse.debug.core.ILaunchConfiguration; |
33 import org.eclipse.debug.core.ILaunchManager; |
33 import org.eclipse.debug.core.ILaunchManager; |
34 import org.eclipse.debug.core.model.ILaunchConfigurationDelegate; |
34 import org.eclipse.debug.core.model.ILaunchConfigurationDelegate; |
|
35 import org.eclipse.ui.IWorkbench; |
|
36 import org.eclipse.ui.IWorkbenchWindow; |
|
37 import org.eclipse.ui.PlatformUI; |
35 import org.symbian.tools.wrttools.debug.internal.Activator; |
38 import org.symbian.tools.wrttools.debug.internal.Activator; |
36 import org.symbian.tools.wrttools.debug.internal.IConstants; |
39 import org.symbian.tools.wrttools.debug.internal.IConstants; |
37 import org.symbian.tools.wrttools.previewer.PreviewerPlugin; |
40 import org.symbian.tools.wrttools.previewer.PreviewerPlugin; |
38 |
41 |
39 public class WidgetLaunchDelegate implements ILaunchConfigurationDelegate { |
42 public class WidgetLaunchDelegate implements ILaunchConfigurationDelegate { |
41 |
44 |
42 public void launch(ILaunchConfiguration configuration, String mode, final ILaunch launch, IProgressMonitor monitor) |
45 public void launch(ILaunchConfiguration configuration, String mode, final ILaunch launch, IProgressMonitor monitor) |
43 throws CoreException { |
46 throws CoreException { |
44 monitor.beginTask("Preparing WRT Debugger", IProgressMonitor.UNKNOWN); |
47 monitor.beginTask("Preparing WRT Debugger", IProgressMonitor.UNKNOWN); |
45 ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); |
48 ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); |
|
49 final IWorkbench workbench = PlatformUI.getWorkbench(); |
|
50 final IWorkbenchWindow window = workbench.getWorkbenchWindows()[0]; |
|
51 final boolean[] retvalue = new boolean[1]; |
|
52 window.getShell().getDisplay().syncExec(new Runnable() { |
|
53 public void run() { |
|
54 retvalue[0] = workbench.saveAllEditors(true); |
|
55 } |
|
56 }); |
|
57 if (!retvalue[0]) { |
|
58 launchManager.removeLaunch(launch); |
|
59 return; |
|
60 } |
46 boolean debug = mode.equals(ILaunchManager.DEBUG_MODE); |
61 boolean debug = mode.equals(ILaunchManager.DEBUG_MODE); |
47 try { |
62 try { |
48 // 1. Load all parameters |
63 // 1. Load all parameters |
49 IProject project = getProject(configuration); |
64 IProject project = getProject(configuration); |
50 isProjectDebugged(project, launchManager, launch); |
65 isProjectDebugged(project, launchManager, launch); |