WRT wizards will switch to JS perspective on completion Milestone_1
authorEugene Ostroukhov <eostroukhov@symbian.org>
Wed, 13 Jan 2010 15:13:10 -0800
changeset 33 71a6ac16b759
parent 32 04290bdab225
child 34 a590cbae56f3
WRT wizards will switch to JS perspective on completion
org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/AptanaProjectsImportWizard.java
org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/WrtWidgetWizard.java
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/AptanaProjectsImportWizard.java	Wed Jan 13 11:38:38 2010 -0800
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/AptanaProjectsImportWizard.java	Wed Jan 13 15:13:10 2010 -0800
@@ -18,14 +18,20 @@
  */
 package org.symbian.tools.wrttools.wizards;
 
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExecutableExtension;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.wizard.Wizard;
 import org.eclipse.ui.IImportWizard;
 import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard;
 
-public class AptanaProjectsImportWizard extends Wizard implements IImportWizard {
+public class AptanaProjectsImportWizard extends Wizard implements
+		IImportWizard, IExecutableExtension {
 
 	private AptanaProjectLocationWizardPage mainPage;
+	private IConfigurationElement config;
 
 	public AptanaProjectsImportWizard() {
 		setWindowTitle("Import Aptana Project");
@@ -40,7 +46,12 @@
 
 	@Override
 	public boolean performFinish() {
-		return mainPage.createProjects();
+		if (mainPage.createProjects()) {
+			BasicNewProjectResourceWizard.updatePerspective(config);
+			return true;
+		} else {
+			return false;
+		}
 	}
 
 	@Override
@@ -48,10 +59,15 @@
 		mainPage = new AptanaProjectLocationWizardPage();
 		addPage(mainPage);
 	}
-	
+
 	@Override
 	public void init(IWorkbench workbench, IStructuredSelection selection) {
 		// Do nothing
 	}
 
+	@Override
+	public void setInitializationData(IConfigurationElement config,
+			String propertyName, Object data) throws CoreException {
+		this.config = config;
+	}
 }
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/WrtWidgetWizard.java	Wed Jan 13 11:38:38 2010 -0800
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/WrtWidgetWizard.java	Wed Jan 13 15:13:10 2010 -0800
@@ -41,6 +41,8 @@
 import org.eclipse.core.resources.IWorkspaceRunnable;
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExecutableExtension;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
@@ -54,18 +56,20 @@
 import org.eclipse.ui.INewWizard;
 import org.eclipse.ui.IWorkbench;
 import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
+import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard;
 import org.symbian.tools.wrttools.Activator;
 import org.symbian.tools.wrttools.core.ProjectTemplate;
 import org.symbian.tools.wrttools.util.NonClosingStream;
 import org.symbian.tools.wrttools.util.ProjectUtils;
 
-public class WrtWidgetWizard extends Wizard implements INewWizard {
+public class WrtWidgetWizard extends Wizard implements INewWizard, IExecutableExtension {
 	private WizardNewProjectCreationPage resourcePage;
 	private WizardContext context;
 	private DataBindingContext bindingContext;
 	private Map<ProjectTemplate, WRTProjectDetailsWizardPage> templateDetails = new HashMap<ProjectTemplate, WRTProjectDetailsWizardPage>();
 	private WRTProjectTemplateWizardPage templatesPage;
 	private WRTProjectFilesWizardPage filesPage;
+	private IConfigurationElement config;
 
 	public WrtWidgetWizard() {
 		setWindowTitle("New WRT Widget");
@@ -86,6 +90,7 @@
 		} catch (InterruptedException e) {
 			Activator.log(e);
 		}
+		BasicNewProjectResourceWizard.updatePerspective(config);
 		return true;
 	}
 
@@ -256,4 +261,10 @@
 				.getLocation();
 		return workspace.isPrefixOf(project);
 	}
+	
+	@Override
+	public void setInitializationData(IConfigurationElement config,
+			String propertyName, Object data) throws CoreException {
+		this.config = config;
+	}
 }