KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > ui > wizards > NewPackageCreationWizard


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.internal.ui.wizards;
12
13 import org.eclipse.core.runtime.CoreException;
14 import org.eclipse.core.runtime.IProgressMonitor;
15
16 import org.eclipse.jdt.core.IJavaElement;
17
18 import org.eclipse.jdt.ui.wizards.NewPackageWizardPage;
19
20 import org.eclipse.jdt.internal.ui.JavaPlugin;
21 import org.eclipse.jdt.internal.ui.JavaPluginImages;
22
23 public class NewPackageCreationWizard extends NewElementWizard {
24
25     private NewPackageWizardPage fPage;
26
27     public NewPackageCreationWizard() {
28         super();
29         setDefaultPageImageDescriptor(JavaPluginImages.DESC_WIZBAN_NEWPACK);
30         setDialogSettings(JavaPlugin.getDefault().getDialogSettings());
31         setWindowTitle(NewWizardMessages.NewPackageCreationWizard_title);
32     }
33
34     /*
35      * @see Wizard#addPages
36      */

37     public void addPages() {
38         super.addPages();
39         fPage= new NewPackageWizardPage();
40         addPage(fPage);
41         fPage.init(getSelection());
42     }
43     
44     /* (non-Javadoc)
45      * @see org.eclipse.jdt.internal.ui.wizards.NewElementWizard#finishPage(org.eclipse.core.runtime.IProgressMonitor)
46      */

47     protected void finishPage(IProgressMonitor monitor) throws InterruptedException JavaDoc, CoreException {
48         fPage.createPackage(monitor); // use the full progress monitor
49
}
50     
51     /* (non-Javadoc)
52      * @see org.eclipse.jface.wizard.IWizard#performFinish()
53      */

54     public boolean performFinish() {
55         boolean res= super.performFinish();
56         if (res) {
57             selectAndReveal(fPage.getModifiedResource());
58         }
59         return res;
60     }
61     
62     /* (non-Javadoc)
63      * @see org.eclipse.jdt.internal.ui.wizards.NewElementWizard#getCreatedElement()
64      */

65     public IJavaElement getCreatedElement() {
66         return fPage.getNewPackageFragment();
67     }
68     
69 }
70
Popular Tags