From 5345c12509839739462d3cb4c11bb73691d7e430 Mon Sep 17 00:00:00 2001 From: choochter <choochter> Date: Fri, 7 Feb 2003 16:42:31 +0000 Subject: [PATCH] Temporarily replace new Project Wizard until errors in old one investigated.. --- net.sourceforge.phpeclipse/plugin.xml | 19 ++++- .../phpeclipse/wizards/TempnewPHPProject.java | 93 ++++++++++++++++++++ 2 files changed, 110 insertions(+), 2 deletions(-) create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/wizards/TempnewPHPProject.java diff --git a/net.sourceforge.phpeclipse/plugin.xml b/net.sourceforge.phpeclipse/plugin.xml index eb01250..0cffe48 100644 --- a/net.sourceforge.phpeclipse/plugin.xml +++ b/net.sourceforge.phpeclipse/plugin.xml @@ -81,7 +81,9 @@ name="%newWizardCategory.name" id="net.sourceforge.phpeclipse.wizards.NewWizardCategoryPHP"> </category> - <wizard +<!-- +Temporarily replaced until errors can be ironed out... + <wizard name="%newWizardPHPProject.name" icon="icons/obj16/php.gif" category="net.sourceforge.phpeclipse.wizards.NewWizardCategoryPHP" @@ -92,7 +94,20 @@ Create a new PHP project. </description> </wizard> - <wizard +<this wizard replaces it as it works - maybe not as pretty but still> +--> + <wizard + name="%newWizardPHPProject.name" + icon="icons/obj16/php.gif" + category="net.sourceforge.phpeclipse.wizards.NewWizardCategoryPHP" + class="net.sourceforge.phpeclipse.wizards.TempnewPHPProject" + project="true" + id="net.sourceforge.phpeclipse.wizards.NewWizardProjectCreation"> + <description> + Create a new PHP project. + </description> + </wizard> + <wizard name="%newWizardPHPFile.name" icon="icons/obj16/phpedit.gif" category="net.sourceforge.phpeclipse.wizards.NewWizardCategoryPHP" diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/wizards/TempnewPHPProject.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/wizards/TempnewPHPProject.java new file mode 100644 index 0000000..ec03535 --- /dev/null +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/wizards/TempnewPHPProject.java @@ -0,0 +1,93 @@ +package net.sourceforge.phpeclipse.wizards; + +import java.lang.reflect.InvocationTargetException; + +import net.sourceforge.phpdt.internal.ui.util.ExceptionHandler; +import net.sourceforge.phpeclipse.PHPCore; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectDescription; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Platform; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.INewWizard; +import org.eclipse.ui.dialogs.WizardNewProjectCreationPage; +import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard; +import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard; + + +public class TempnewPHPProject extends BasicNewResourceWizard implements INewWizard { +/*This class has been added to cvs to provide a project page that + * works correctly and doesn't freezde while i investigate the + * errors completely + */ + private WizardNewProjectCreationPage phpProjPage; + private IConfigurationElement fConfigElement; + + public TempnewPHPProject() { + setNeedsProgressMonitor(true); + setWindowTitle("New Project creation"); //$NON-NLS-1$ + + } + + public void addPages() { + super.addPages(); + phpProjPage= new WizardNewProjectCreationPage("NewProjectCreationWizard"); //$NON-NLS-1$ + phpProjPage.setTitle(PHPWizardMessages.getString("WizardNewProjectCreationPage.pageTitle")); //$NON-NLS-1$ + phpProjPage.setDescription(PHPWizardMessages.getString("WizardNewProjectCreationPage.pageDescription")); //$NON-NLS-1$ + addPage(phpProjPage); + } + + public void setInitializationData(IConfigurationElement cfig, String propertyName, Object data) { + fConfigElement= cfig; + } + + protected void initializeDefaultPageImageDescriptor() { + // not used yet + } + + protected void finishPage() throws InterruptedException, CoreException { + createProject(phpProjPage.getProjectHandle(), phpProjPage.getLocationPath(), new NullProgressMonitor()); + BasicNewProjectResourceWizard.updatePerspective(fConfigElement); + selectAndReveal(phpProjPage.getProjectHandle()); + } + protected void handleFinishException(Shell shell, InvocationTargetException e) { + ExceptionHandler.handle(e, getShell(), "Error title", "Error message"); + } + + public boolean performFinish() { + try { + finishPage(); + } catch (InterruptedException e) { + } catch (CoreException e) { + } + return true; + } + + public void createProject(IProject project, IPath locationPath, IProgressMonitor monitor) throws CoreException { + try { + if (!project.exists()) { + IProjectDescription desc= project.getWorkspace().newProjectDescription(project.getName()); + if (Platform.getLocation().equals(locationPath)) { + locationPath= null; + } + desc.setLocation(locationPath); + project.create(desc, monitor); + monitor= null; + } + if (!project.isOpen()) { + project.open(monitor); + monitor= null; + } + PHPCore.addPHPNature(project, new NullProgressMonitor()); + } finally { + if (monitor != null) { + monitor.done(); + } + } + } +} -- 1.7.1