debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/LaunchWizard.java
branchRCL_2_4
changeset 953 68b6a294ab01
parent 911 81a2e70a37d7
child 966 15c9cbbf6707
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/LaunchWizard.java	Sun Feb 14 20:52:26 2010 -0600
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/LaunchWizard.java	Mon Feb 15 13:20:03 2010 -0600
@@ -18,14 +18,12 @@
 package com.nokia.cdt.internal.debug.launch.newwizard;
 
 import java.text.MessageFormat;
-import java.util.List;
 
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
 import org.eclipse.jface.dialogs.Dialog;
 import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.jface.dialogs.IPageChangedListener;
-import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.dialogs.PageChangedEvent;
 import org.eclipse.jface.layout.GridDataFactory;
 import org.eclipse.jface.wizard.IWizardContainer;
@@ -38,28 +36,29 @@
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
 
 import com.nokia.carbide.remoteconnections.interfaces.IService;
+import com.nokia.cdt.internal.debug.launch.LaunchPlugin;
+import com.nokia.cdt.internal.debug.launch.wizard.ILaunchCreationWizard;
+import com.nokia.cdt.internal.debug.launch.wizard.LaunchOptions;
 
 /**
  * New launch wizard for Carbide 3.0.
  * 
  * See https://xdabug001.ext.nokia.com/bugzilla/show_bug.cgi?id=10419
  */
-public class LaunchWizard extends Wizard {
+public class LaunchWizard extends Wizard implements ILaunchCreationWizard {
 	 
-	private LaunchOptionsData launchData;
+	private LaunchWizardData launchData;
 	private UnifiedLaunchOptionsPage mainPage;
 	private Button advancedButton;
 	private boolean advancedEdit;
 	private IPageChangedListener pageChangedListener;
+	private boolean hasFinished;
 	
-	public LaunchWizard(IProject project, String configurationName, 
-			List<IPath> mmps, List<IPath> exes, IPath defaultExecutable,  
-			boolean isEmulation, boolean emulatorOnly, String mode,
-			IService trkService) {
-		launchData = new LaunchOptionsData(mmps, exes, defaultExecutable, project, configurationName,
-				isEmulation, emulatorOnly, mode, trkService);
+	public LaunchWizard(LaunchOptions launchOptions, IService trkService) {
+		launchData = new LaunchWizardData(launchOptions, trkService);
 		mainPage = new UnifiedLaunchOptionsPage(launchData); 
 		mainPage.initializeSettings();
 		setWindowTitle("New Launch Configuration Wizard");
@@ -176,8 +175,33 @@
 
 	@Override
 	public boolean performFinish() {
-		MessageDialog.openWarning(getShell(), "New Launch Configuration Wizard", "Launching from this wizard not enabled yet");
-		return false;
+		hasFinished = true;
+		return true;
+	}
+
+	public boolean shouldOpenLaunchConfigurationDialog() {
+		return hasFinished && advancedEdit;
 	}
 
+	public ILaunchConfigurationWorkingCopy getLaunchConfiguration() {
+		if (!hasFinished)
+			return null;
+		
+		ILaunchConfigurationWorkingCopy config = null;
+		try {
+			config = launchData.createConfiguration();
+		} catch (CoreException e) {
+			LaunchPlugin.log(e);
+		}
+		
+		return config;
+	}
+
+	public void init() {
+	}
+
+	public int openWizard(Shell shell) {
+		WizardDialog dialog = new WizardDialog(shell, this);
+		return dialog.open();
+	}
 }