23bf845cd3c790e50463643a9a42123b7cf50737
[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
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
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(PHPeclipsePlugin.getDefault().getDialogSettings());
33                 setWindowTitle(NewWizardMessages.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          * @see org.eclipse.jdt.internal.ui.wizards.NewElementWizard#finishPage(org.eclipse.core.runtime.IProgressMonitor)
49          */
50         protected void finishPage(IProgressMonitor monitor) throws InterruptedException, CoreException {
51                 fPage.createType(monitor); // use the full progress monitor
52                 ICompilationUnit cu= JavaModelUtil.toOriginal(fPage.getCreatedType().getCompilationUnit());
53                 if (cu != null) {
54                         IResource resource= cu.getResource();
55                         selectAndReveal(resource);
56                         openResource((IFile) resource);
57                 }       
58         }
59         
60         /* (non-Javadoc)
61          * @see org.eclipse.jface.wizard.IWizard#performFinish()
62          */
63         public boolean performFinish() {
64 //              warnAboutTypeCommentDeprecation();
65                 return super.performFinish();
66         }
67
68 }