Eclipse Platform
Release 3.2

org.eclipse.ui.wizards.newresource
Class BasicNewProjectResourceWizard

java.lang.Object
  extended by org.eclipse.jface.wizard.Wizard
      extended by org.eclipse.ui.wizards.newresource.BasicNewResourceWizard
          extended by org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard
All Implemented Interfaces:
IExecutableExtension, IWizard, INewWizard, IWorkbenchWizard

public class BasicNewProjectResourceWizard
extends BasicNewResourceWizard
implements IExecutableExtension

Standard workbench wizard that creates a new project resource in the workspace.

This class may be instantiated and used without further configuration; this class is not intended to be subclassed.

Example:

 IWorkbenchWizard wizard = new BasicNewProjectResourceWizard();
 wizard.init(workbench, selection);
 WizardDialog dialog = new WizardDialog(shell, wizard);
 dialog.open();
 
During the call to open, the wizard dialog is presented to the user. When the user hits Finish, a project resource with the user-specified name is created, the dialog closes, and the call to open returns.


Field Summary
 
Fields inherited from class org.eclipse.ui.wizards.newresource.BasicNewResourceWizard
selection
 
Fields inherited from class org.eclipse.jface.wizard.Wizard
DEFAULT_IMAGE
 
Constructor Summary
BasicNewProjectResourceWizard()
          Creates a wizard for creating a new project resource in the workspace.
 
Method Summary
 void addPages()
          The Wizard implementation of this IWizard method does nothing.
 IProject getNewProject()
          Returns the newly created project.
 void init(IWorkbench workbench, IStructuredSelection currentSelection)
          The BasicNewResourceWizard implementation of this IWorkbenchWizard method records the given workbench and selection, and initializes the default banner image for the pages by calling initializeDefaultPageImageDescriptor.
protected  void initializeDefaultPageImageDescriptor()
          Initializes the default page image descriptor to an appropriate banner.
 boolean performFinish()
          Subclasses must implement this IWizard method to perform any special finish processing for their wizard.
 void setInitializationData(IConfigurationElement cfig, java.lang.String propertyName, java.lang.Object data)
          Stores the configuration element for the wizard.
protected  void updatePerspective()
          Updates the perspective for the active page within the window.
static void updatePerspective(IConfigurationElement configElement)
          Updates the perspective based on the current settings in the Workbench/Perspectives preference page.
 
Methods inherited from class org.eclipse.ui.wizards.newresource.BasicNewResourceWizard
getSelection, getWorkbench, selectAndReveal, selectAndReveal
 
Methods inherited from class org.eclipse.jface.wizard.Wizard
addPage, canFinish, createPageControls, dispose, getContainer, getDefaultPageImage, getDialogSettings, getNextPage, getPage, getPageCount, getPages, getPreviousPage, getShell, getStartingPage, getTitleBarColor, getWindowTitle, isHelpAvailable, needsPreviousAndNextButtons, needsProgressMonitor, performCancel, setContainer, setDefaultPageImageDescriptor, setDialogSettings, setForcePreviousAndNextButtons, setHelpAvailable, setNeedsProgressMonitor, setTitleBarColor, setWindowTitle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.jface.wizard.IWizard
canFinish, createPageControls, dispose, getContainer, getDefaultPageImage, getDialogSettings, getNextPage, getPage, getPageCount, getPages, getPreviousPage, getStartingPage, getTitleBarColor, getWindowTitle, isHelpAvailable, needsPreviousAndNextButtons, needsProgressMonitor, performCancel, setContainer
 

Constructor Detail

BasicNewProjectResourceWizard

public BasicNewProjectResourceWizard()
Creates a wizard for creating a new project resource in the workspace.

Method Detail

addPages

public void addPages()
Description copied from class: Wizard
The Wizard implementation of this IWizard method does nothing. Subclasses should extend if extra pages need to be added before the wizard opens. New pages should be added by calling addPage.

Specified by:
addPages in interface IWizard
Overrides:
addPages in class Wizard

getNewProject

public IProject getNewProject()
Returns the newly created project.

Returns:
the created project, or null if project not created

init

public void init(IWorkbench workbench,
                 IStructuredSelection currentSelection)
Description copied from class: BasicNewResourceWizard
The BasicNewResourceWizard implementation of this IWorkbenchWizard method records the given workbench and selection, and initializes the default banner image for the pages by calling initializeDefaultPageImageDescriptor. Subclasses may extend.

Specified by:
init in interface IWorkbenchWizard
Overrides:
init in class BasicNewResourceWizard
Parameters:
workbench - the current workbench
currentSelection - the current object selection

initializeDefaultPageImageDescriptor

protected void initializeDefaultPageImageDescriptor()
Description copied from class: BasicNewResourceWizard
Initializes the default page image descriptor to an appropriate banner. By calling setDefaultPageImageDescriptor. The default implementation of this method uses a generic new wizard image.

Subclasses may reimplement.

Overrides:
initializeDefaultPageImageDescriptor in class BasicNewResourceWizard

performFinish

public boolean performFinish()
Description copied from class: Wizard
Subclasses must implement this IWizard method to perform any special finish processing for their wizard.

Specified by:
performFinish in interface IWizard
Specified by:
performFinish in class Wizard
Returns:
true to indicate the finish request was accepted, and false to indicate that the finish request was refused

setInitializationData

public void setInitializationData(IConfigurationElement cfig,
                                  java.lang.String propertyName,
                                  java.lang.Object data)
Stores the configuration element for the wizard. The config element will be used in performFinish to set the result perspective.

Specified by:
setInitializationData in interface IExecutableExtension
Parameters:
cfig - the configuration element used to trigger this execution. It can be queried by the executable extension for specific configuration properties
propertyName - the name of an attribute of the configuration element used on the createExecutableExtension(String) call. This argument can be used in the cases where a single configuration element is used to define multiple executable extensions.
data - adapter data in the form of a String, a Hashtable, or null.
See Also:
IConfigurationElement.createExecutableExtension(String)

updatePerspective

protected void updatePerspective()
Updates the perspective for the active page within the window.


updatePerspective

public static void updatePerspective(IConfigurationElement configElement)
Updates the perspective based on the current settings in the Workbench/Perspectives preference page. Use the setting for the new perspective opening if we are set to open in a new perspective.

A new project wizard class will need to implement the IExecutableExtension interface so as to gain access to the wizard's IConfigurationElement. That is the configuration element to pass into this method.

Parameters:
configElement - - the element we are updating with
See Also:
IPreferenceConstants.OPM_NEW_WINDOW, IPreferenceConstants.OPM_ACTIVE_PAGE, IWorkbenchPreferenceConstants.NO_NEW_PERSPECTIVE

Eclipse Platform
Release 3.2

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.