KickJava   Java API By Example, From Geeks To Geeks.

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


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.internal.ui.JavaPlugin;
19 import org.eclipse.jdt.internal.ui.JavaPluginImages;
20
21
22 public class NewSourceFolderCreationWizard extends NewElementWizard {
23
24     private NewSourceFolderWizardPage fPage;
25
26     public NewSourceFolderCreationWizard() {
27         super();
28         setDefaultPageImageDescriptor(JavaPluginImages.DESC_WIZBAN_NEWSRCFOLDR);
29         setDialogSettings(JavaPlugin.getDefault().getDialogSettings());
30         setWindowTitle(NewWizardMessages.NewSourceFolderCreationWizard_title);
31     }
32
33     /*
34      * @see Wizard#addPages
35      */

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

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

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

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