1 /*******************************************************************************
2 * Copyright (c) 2000, 2012 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
9 * IBM Corporation - initial API and implementation
10 * Philippe Marschall <philippe.marschall@netcetera.ch> - [type wizards] Allow the creation of a compilation unit called package-info.java - https://bugs.eclipse.org/86168
11 * Michael Pellaton <michael.pellaton@netcetera.ch> - [type wizards] Allow the creation of a compilation unit called package-info.java - https://bugs.eclipse.org/86168
12 *******************************************************************************/
13 package org.eclipse.jdt.internal.ui.wizards;
15 import org.eclipse.core.runtime.CoreException;
16 import org.eclipse.core.runtime.IProgressMonitor;
18 import org.eclipse.core.resources.IFile;
19 import org.eclipse.core.resources.IResource;
21 import org.eclipse.jdt.core.IJavaElement;
23 import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
25 import org.eclipse.jdt.ui.wizards.NewPackageWizardPage;
27 import org.eclipse.jdt.internal.ui.JavaPlugin;
28 import org.eclipse.jdt.internal.ui.JavaPluginImages;
30 public class NewPackageCreationWizard extends NewElementWizard {
32 public NewPackageWizardPage fPage;
34 public NewPackageCreationWizard(NewPackageWizardPage page) {
36 setDefaultPageImageDescriptor(JavaPluginImages.DESC_WIZBAN_NEWPACK);
37 setDialogSettings(JavaPlugin.getDefault().getDialogSettings());
38 setWindowTitle(NewWizardMessages.NewPackageCreationWizard_title);
43 public NewPackageCreationWizard() {
48 * @see Wizard#addPages
51 public void addPages() {
54 fPage= new NewPackageWizardPage();
55 fPage.generated_6243876990237528117(this);
61 * @see org.eclipse.jdt.internal.ui.wizards.NewElementWizard#finishPage(org.eclipse.core.runtime.IProgressMonitor)
64 protected void finishPage(IProgressMonitor monitor) throws InterruptedException, CoreException {
65 fPage.createPackage(monitor); // use the full progress monitor
69 * @see org.eclipse.jface.wizard.IWizard#performFinish()
72 public boolean performFinish() {
73 boolean res= super.performFinish();
75 IResource resource= fPage.getModifiedResource();
76 selectAndReveal(resource);
77 if (resource instanceof IFile && resource.getName().equals(JavaModelUtil.PACKAGE_INFO_JAVA)) {
78 openResource((IFile) resource);
85 * @see org.eclipse.jdt.internal.ui.wizards.NewElementWizard#getCreatedElement()
88 public IJavaElement getCreatedElement() {
89 return fPage.getNewPackageFragment();