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
25 * This class has been added to cvs to provide a project page that works
26 * correctly and doesn't freezde while i investigate the errors completely
28 private WizardNewProjectCreationPage phpProjPage;
30 private IConfigurationElement fConfigElement;
32 public TempnewPHPProject() {
33 setNeedsProgressMonitor(true);
34 setWindowTitle("New Project creation"); //$NON-NLS-1$
38 public void addPages() {
40 phpProjPage = new WizardNewProjectCreationPage(
41 "NewProjectCreationWizard"); //$NON-NLS-1$
42 phpProjPage.setTitle(PHPWizardMessages
43 .getString("WizardNewProjectCreationPage.pageTitle")); //$NON-NLS-1$
44 phpProjPage.setDescription(PHPWizardMessages
45 .getString("WizardNewProjectCreationPage.pageDescription")); //$NON-NLS-1$
49 public void setInitializationData(IConfigurationElement cfig,
50 String propertyName, Object data) {
51 fConfigElement = cfig;
54 protected void initializeDefaultPageImageDescriptor() {
58 protected void finishPage() throws InterruptedException, CoreException {
59 createProject(phpProjPage.getProjectHandle(), phpProjPage
60 .getLocationPath(), new NullProgressMonitor());
61 BasicNewProjectResourceWizard.updatePerspective(fConfigElement);
62 selectAndReveal(phpProjPage.getProjectHandle());
65 protected void handleFinishException(Shell shell,
66 InvocationTargetException e) {
67 ExceptionHandler.handle(e, getShell(), "Error title", "Error message");
70 public boolean performFinish() {
73 } catch (InterruptedException e) {
74 } catch (CoreException e) {
79 public void createProject(IProject project, IPath locationPath,
80 IProgressMonitor monitor) throws CoreException {
82 if (!project.exists()) {
83 IProjectDescription desc = project.getWorkspace()
84 .newProjectDescription(project.getName());
85 if (Platform.getLocation().equals(locationPath)) {
88 desc.setLocation(locationPath);
89 project.create(desc, monitor);
92 if (!project.isOpen()) {
93 project.open(monitor);
96 JavaCore.addPHPNature(project, new NullProgressMonitor());
98 if (monitor != null) {