Using standard dialog org.eclipse.ui.dialogs.ElementListSelectionDialog instead of...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / ui / wizards / NewClassCreationWizard.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2003 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials 
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package net.sourceforge.phpdt.internal.ui.wizards;
12
13 import net.sourceforge.phpdt.core.ICompilationUnit;
14 import net.sourceforge.phpdt.internal.corext.util.JavaModelUtil;
15 import net.sourceforge.phpdt.internal.ui.PHPUiImages;
16 import net.sourceforge.phpdt.ui.wizards.NewClassWizardPage;
17 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
18
19 import org.eclipse.core.resources.IFile;
20 import org.eclipse.core.resources.IResource;
21 import org.eclipse.core.runtime.CoreException;
22 import org.eclipse.core.runtime.IProgressMonitor;
23
24 public class NewClassCreationWizard extends NewElementWizard {
25
26         private NewClassWizardPage fPage;
27
28         public NewClassCreationWizard() {
29                 super();
30                 setDefaultPageImageDescriptor(PHPUiImages.DESC_WIZBAN_NEWCLASS);
31                 setDialogSettings(PHPeclipsePlugin.getDefault().getDialogSettings());
32                 setWindowTitle(NewWizardMessages
33                                 .getString("NewClassCreationWizard.title")); //$NON-NLS-1$
34         }
35
36         /*
37          * @see Wizard#createPages
38          */
39         public void addPages() {
40                 super.addPages();
41                 fPage = new NewClassWizardPage();
42                 addPage(fPage);
43                 fPage.init(getSelection());
44         }
45
46         /*
47          * (non-Javadoc)
48          * 
49          * @see net.sourceforge.phpdt.internal.ui.wizards.NewElementWizard#finishPage(org.eclipse.core.runtime.IProgressMonitor)
50          */
51         protected void finishPage(IProgressMonitor monitor)
52                         throws InterruptedException, CoreException {
53                 fPage.createType(monitor); // use the full progress monitor
54                 ICompilationUnit cu = JavaModelUtil.toOriginal(fPage.getCreatedType()
55                                 .getCompilationUnit());
56                 if (cu != null) {
57                         IResource resource = cu.getResource();
58                         selectAndReveal(resource);
59                         openResource((IFile) resource);
60                 }
61         }
62
63         /*
64          * (non-Javadoc)
65          * 
66          * @see org.eclipse.jface.wizard.IWizard#performFinish()
67          */
68         public boolean performFinish() {
69                 // warnAboutTypeCommentDeprecation();
70                 return super.performFinish();
71         }
72
73 }