1 package net.sourceforge.phpeclipse.wizards;
 
   3 import java.lang.reflect.InvocationTargetException;
 
   5 import net.sourceforge.phpdt.core.JavaCore;
 
   6 import net.sourceforge.phpdt.internal.ui.util.ExceptionHandler;
 
   8 import org.eclipse.core.resources.IProject;
 
   9 import org.eclipse.core.resources.IProjectDescription;
 
  10 import org.eclipse.core.runtime.CoreException;
 
  11 import org.eclipse.core.runtime.IConfigurationElement;
 
  12 import org.eclipse.core.runtime.IPath;
 
  13 import org.eclipse.core.runtime.IProgressMonitor;
 
  14 import org.eclipse.core.runtime.NullProgressMonitor;
 
  15 import org.eclipse.core.runtime.Platform;
 
  16 import org.eclipse.swt.widgets.Shell;
 
  17 import org.eclipse.ui.INewWizard;
 
  18 import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
 
  19 import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard;
 
  20 import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard;
 
  23 public class TempnewPHPProject extends BasicNewResourceWizard implements INewWizard {
 
  24 /*This class has been added to cvs to provide a project page that
 
  25  * works correctly and doesn't freezde while i investigate the 
 
  28     private WizardNewProjectCreationPage phpProjPage;
 
  29     private IConfigurationElement fConfigElement;
 
  31     public TempnewPHPProject() {
 
  32         setNeedsProgressMonitor(true);
 
  33         setWindowTitle("New Project creation"); //$NON-NLS-1$
 
  37     public void addPages() {
 
  39         phpProjPage= new WizardNewProjectCreationPage("NewProjectCreationWizard"); //$NON-NLS-1$
 
  40         phpProjPage.setTitle(PHPWizardMessages.getString("WizardNewProjectCreationPage.pageTitle")); //$NON-NLS-1$
 
  41         phpProjPage.setDescription(PHPWizardMessages.getString("WizardNewProjectCreationPage.pageDescription")); //$NON-NLS-1$
 
  45     public void setInitializationData(IConfigurationElement cfig, String propertyName, Object data) {
 
  49     protected void initializeDefaultPageImageDescriptor() {
 
  53         protected void finishPage() throws InterruptedException, CoreException {
 
  54                  createProject(phpProjPage.getProjectHandle(), phpProjPage.getLocationPath(), new NullProgressMonitor());
 
  55                  BasicNewProjectResourceWizard.updatePerspective(fConfigElement);
 
  56                  selectAndReveal(phpProjPage.getProjectHandle());
 
  58     protected void handleFinishException(Shell shell, InvocationTargetException e) {
 
  59         ExceptionHandler.handle(e, getShell(), "Error title", "Error message");
 
  62     public boolean performFinish() {
 
  65                 } catch (InterruptedException e) {
 
  66                 } catch (CoreException e) {
 
  71     public void createProject(IProject project, IPath locationPath, IProgressMonitor monitor) throws CoreException {
 
  73                         if (!project.exists()) {
 
  74                                 IProjectDescription desc= project.getWorkspace().newProjectDescription(project.getName());
 
  75                                 if (Platform.getLocation().equals(locationPath)) {
 
  78                                 desc.setLocation(locationPath);
 
  79                                 project.create(desc, monitor);
 
  82                         if (!project.isOpen()) {
 
  83                                 project.open(monitor);
 
  86                         JavaCore.addPHPNature(project, new NullProgressMonitor());
 
  88                         if (monitor != null) {