/* * Created on May 26, 2003 * * To change the template for this generated file go to * Window>Preferences>Java>Code Generation>Code and Comments */ package CDBuilder; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.IPath; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard; /** * * This class creates the project wizard that creates the new project * as well as the notes file * * @author Lucie Zhao and Sherwin Sim * @version 1 May - August 2003 * */ public class CDProjectWizard extends BasicNewProjectResourceWizard{ /** the workbench the project is using */ private IWorkbench workbench; /** the selected structure */ private IStructuredSelection selection ; /** the page to create a notes file */ public CDProjectCreationPage fPage; /** * @see BasicNewProjectResourceWizard#BasicNewProjectResourceWizard() * */ public CDProjectWizard() { super(); } /* * @see Wizard#addPages */ /** * adds the a page that lets the user enter in a name */ public void addPages() { //create a new CDProjectCreation page fPage = new CDProjectCreationPage (workbench, selection); addPage(fPage); super.addPages(); } /** * Makes the project, sets the path for the notes file and * create the file *@return true if the new project is able to be created */ public boolean performFinish() { //creates the project boolean exit = super.performFinish(); //get the location of the project IProject project = getNewProject(); IPath path = project.getLocation(); fPage.newPath = path; //saves the new notes file in the same project space exit = fPage.finish(); //refreshes the window to let the new file show up try { project.refreshLocal(1,null); } catch (Exception e) { System.out.println(e); } super.updatePerspective(); super.selectAndReveal(project); return exit; } /** * Initializes the workbench and selection * sets the window title * @param workbench the workbench that is used * @param selection the selected structure */ public void init(IWorkbench workbench,IStructuredSelection selection) { super.init(workbench, selection); this.workbench = workbench; this.selection = selection; setWindowTitle("New_CD++_File"); } }