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;
 
  22 public class TempnewPHPProject extends BasicNewResourceWizard implements INewWizard {
 
  24    * This class has been added to cvs to provide a project page that works correctly and doesn't freezde while i investigate the
 
  27   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) {
 
  46     fConfigElement = cfig;
 
  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());
 
  59   protected void handleFinishException(Shell shell, InvocationTargetException e) {
 
  60     ExceptionHandler.handle(e, getShell(), "Error title", "Error message");
 
  63   public boolean performFinish() {
 
  66     } catch (InterruptedException e) {
 
  67     } catch (CoreException e) {
 
  72   public void createProject(IProject project, IPath locationPath, IProgressMonitor monitor) throws CoreException {
 
  74       if (!project.exists()) {
 
  75         IProjectDescription desc = project.getWorkspace().newProjectDescription(project.getName());
 
  76         if (Platform.getLocation().equals(locationPath)) {
 
  79         desc.setLocation(locationPath);
 
  80         project.create(desc, monitor);
 
  83       if (!project.isOpen()) {
 
  84         project.open(monitor);
 
  87       JavaCore.addPHPNature(project, new NullProgressMonitor());
 
  89       if (monitor != null) {