124576565dda1e80e5a3d20a878abc908f925491
[phpeclipse.git] /
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 import net.sourceforge.phpeclipse.ui.WebUI;
19
20 import org.eclipse.core.resources.IFile;
21 import org.eclipse.core.resources.IResource;
22 import org.eclipse.core.runtime.CoreException;
23 import org.eclipse.core.runtime.IProgressMonitor;
24
25 public class NewClassCreationWizard extends NewElementWizard {
26
27         private NewClassWizardPage fPage;
28
29         public NewClassCreationWizard() {
30                 super();
31                 setDefaultPageImageDescriptor(PHPUiImages.DESC_WIZBAN_NEWCLASS);
32                 setDialogSettings(WebUI.getDefault().getDialogSettings());
33                 setWindowTitle(NewWizardMessages
34                                 .getString("NewClassCreationWizard.title")); //$NON-NLS-1$
35         }
36
37         /*
38          * @see Wizard#createPages
39          */
40         public void addPages() {
41                 super.addPages();
42                 fPage = new NewClassWizardPage();
43                 addPage(fPage);
44                 fPage.init(getSelection());
45         }
46
47         /*
48          * (non-Javadoc)
49          * 
50          * @see net.sourceforge.phpdt.internal.ui.wizards.NewElementWizard#finishPage(org.eclipse.core.runtime.IProgressMonitor)
51          */
52         protected void finishPage(IProgressMonitor monitor)
53                         throws InterruptedException, CoreException {
54                 fPage.createType(monitor); // use the full progress monitor
55                 ICompilationUnit cu = JavaModelUtil.toOriginal(fPage.getCreatedType()
56                                 .getCompilationUnit());
57                 if (cu != null) {
58                         IResource resource = cu.getResource();
59                         selectAndReveal(resource);
60                         openResource((IFile) resource);
61                 }
62         }
63
64         /*
65          * (non-Javadoc)
66          * 
67          * @see org.eclipse.jface.wizard.IWizard#performFinish()
68          */
69         public boolean performFinish() {
70                 // warnAboutTypeCommentDeprecation();
71                 return super.performFinish();
72         }
73
74 }