Mercurial > hg > thermostat-tools-eclipse
view com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/wizards/ThermostatProjectCreationWizard.java @ 135:eef52fe80553
Make wizard page names describe functionality
Make it easier to share wizard pages between wizards by making names
reflect purpose rather than which wizard is using them.
author | Omair Majid <omajid@redhat.com> |
---|---|
date | Tue, 03 Jun 2014 17:32:08 -0400 |
parents | f425cf9c32e8 |
children |
line wrap: on
line source
package com.redhat.thermostat.tools.eclipse.plugin.wizards; import java.io.IOException; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.Status; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.wizard.Wizard; import org.eclipse.ui.INewWizard; import org.eclipse.ui.IWorkbench; import com.redhat.thermostat.tools.eclipse.plugin.Activator; import com.redhat.thermostat.tools.eclipse.plugin.Messages; import com.redhat.thermostat.tools.eclipse.plugin.wizards.NewProjectInformationPage.ProjectModel; public class ThermostatProjectCreationWizard extends Wizard implements INewWizard { private NewProjectInformationPage pageOne; @Override public void init(IWorkbench workbench, IStructuredSelection selection) { setWindowTitle(Messages.ThermostatProjectCreationWizard_dialogTitle); setNeedsProgressMonitor(true); } @Override public void addPages() { pageOne = new NewProjectInformationPage(); addPage(pageOne); } @Override public boolean performFinish() { try { ProjectModel model = pageOne.getProjectInformation(); String groupId = model.getGroupId(); String artifactId = model.getArtifactId(); String version = model.getVersion(); String packagePrefix = model.getPackageName(); String thermostatVersion = model.getThermostatVersion(); createProject(groupId, artifactId, version, packagePrefix, thermostatVersion); } catch (CoreException e) { // TODO Auto-generated catch block e.printStackTrace(); } return true; } private void createProject(String groupId, String artifactId, String version, String packagePrefix, String thermostatVersion) throws CoreException { ProjectCreator creator = new ProjectCreator(groupId, artifactId, version, packagePrefix, thermostatVersion); try { creator.create(); } catch (IOException e) { throw new CoreException(new Status(Status.ERROR, Activator.PLUGIN_ID, "Error creating project", e)); //$NON-NLS-1$ } } }