Eclipse JDT
2.0

org.eclipse.jdt.ui.wizards
Class NewJavaProjectWizardPage

java.lang.Object
  |
  +--org.eclipse.jface.dialogs.DialogPage
        |
        +--org.eclipse.jface.wizard.WizardPage
              |
              +--org.eclipse.jdt.ui.wizards.NewElementWizardPage
                    |
                    +--org.eclipse.jdt.ui.wizards.NewJavaProjectWizardPage
All Implemented Interfaces:
IDialogPage, IMessageProvider, IWizardPage

public class NewJavaProjectWizardPage
extends NewElementWizardPage

Standard wizard page for creating new Java projects. This page can be used in project creation wizards for projects and will configure the project with the Java nature. This page also allows the user to configure the Java project's output location for class files generated by the Java builder.

Whenever possible clients should use the class JavaCapabilityConfigurationPage in favour of this class.


Field Summary
 
Fields inherited from interface org.eclipse.jface.dialogs.IMessageProvider
ERROR, INFORMATION, NONE, WARNING
 
Constructor Summary
NewJavaProjectWizardPage(IWorkspaceRoot root, WizardNewProjectCreationPage mainpage)
          Creates a Java project wizard creation page.
 
Method Summary
 void createControl(Composite parent)
           
protected  IPath getLocationPath()
          Returns the project locaction path.
 IJavaProject getNewJavaProject()
          Returns the Java project handle by converting the result of getProjectHandle() into a Java project.
 IPath getOutputLocation()
          Returns the currently configured output location.
protected  IProject getProjectHandle()
          Returns the project handle.
 IClasspathEntry[] getRawClassPath()
          Returns the currently configured classpath.
 IRunnableWithProgress getRunnable()
          Returns the runnable that will create the Java project.
protected  void initBuildPaths()
          Forces the initialization of the Java project page.
 void setDefaultClassPath(IClasspathEntry[] entries, boolean appendDefaultJRE)
          Sets the default classpath to be used for the new Java project.
 void setDefaultOutputFolder(IPath path)
          Sets the default output location to be used for the new Java project.
 void setProjectModified()
          Sets the project state to modified.
 void setVisible(boolean visible)
          Extend this method to set a user defined default classpath or output location.
 
Methods inherited from class org.eclipse.jdt.ui.wizards.NewElementWizardPage
updateStatus, updateStatus
 
Methods inherited from class org.eclipse.jface.wizard.WizardPage
canFlipToNextPage, getContainer, getDialogSettings, getImage, getName, getNextPage, getPreviousPage, getShell, getWizard, isCurrentPage, isPageComplete, setDescription, setErrorMessage, setImageDescriptor, setMessage, setPageComplete, setPreviousPage, setTitle, setWizard, toString
 
Methods inherited from class org.eclipse.jface.dialogs.DialogPage
convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, dispose, getControl, getDescription, getDialogFontName, getErrorMessage, getFont, getMessage, getMessageType, getTitle, getToolTipText, initializeDialogUnits, isControlCreated, performHelp, setControl, setMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.jface.dialogs.IDialogPage
dispose, getControl, getDescription, getErrorMessage, getMessage, getTitle, performHelp
 

Constructor Detail

NewJavaProjectWizardPage

public NewJavaProjectWizardPage(IWorkspaceRoot root,
                                WizardNewProjectCreationPage mainpage)
Creates a Java project wizard creation page.

The Java project wizard reads project name and location from the main page.

Parameters:
root - the workspace root
mainpage - the main page of the wizard
Method Detail

setDefaultOutputFolder

public void setDefaultOutputFolder(IPath path)
Sets the default output location to be used for the new Java project. This is the path of the folder (with the project) into which the Java builder will generate binary class files corresponding to the project's Java source files.

The wizard will create this folder if required.

The default classpath will be applied when initBuildPaths is called. This is done automatically when the page becomes visible and the project or the default paths have changed.

Parameters:
path - the folder to be taken as the default output path

setDefaultClassPath

public void setDefaultClassPath(IClasspathEntry[] entries,
                                boolean appendDefaultJRE)
Sets the default classpath to be used for the new Java project.

The caller of this method is responsible for creating the classpath entries for the IJavaProject that corresponds to the created project. The caller is responsible for creating any new folders that might be mentioned on the classpath.

The default output location will be applied when initBuildPaths is called. This is done automatically when the page becomes visible and the project or the default paths have changed.

Parameters:
entries - the default classpath entries
appendDefaultJRE - true a variable entry for the default JRE (specified in the preferences) will be added to the classpath.

setProjectModified

public void setProjectModified()
Sets the project state to modified. Doing so will initialize the page the next time it becomes visible.

Since:
2.0

getProjectHandle

protected IProject getProjectHandle()
Returns the project handle. Subclasses should override this method if they don't provide a main page or if they provide their own main page implementation.

Returns:
the project handle

getLocationPath

protected IPath getLocationPath()
Returns the project locaction path. Subclasses should override this method if they don't provide a main page or if they provide their own main page implementation.

Returns:
the project location path

getNewJavaProject

public IJavaProject getNewJavaProject()
Returns the Java project handle by converting the result of getProjectHandle() into a Java project.

Returns:
the Java project handle
See Also:
getProjectHandle()

createControl

public void createControl(Composite parent)
Specified by:
createControl in interface IDialogPage
Specified by:
createControl in class DialogPage

initBuildPaths

protected void initBuildPaths()
Forces the initialization of the Java project page. Default classpath or buildpath will be used if set. The initialization should only be performed when the project or default paths have changed. Toggeling back and forward the pages without changes should not re-initialize the page, as changes from the user will be overwritten.

Since:
2.0

setVisible

public void setVisible(boolean visible)
Extend this method to set a user defined default classpath or output location. The method initBuildPaths is called when the page becomes visible the first time or the project or the default paths have changed.

Specified by:
setVisible in interface IDialogPage
Overrides:
setVisible in class NewElementWizardPage
Parameters:
visible - if true the page becomes visible; otherwise it becomes invisible

getOutputLocation

public IPath getOutputLocation()
Returns the currently configured output location. Note that the returned path might not be valid.

Returns:
the configured output location
Since:
2.0

getRawClassPath

public IClasspathEntry[] getRawClassPath()
Returns the currently configured classpath. Note that the classpath might not be valid.

Returns:
the configured classpath
Since:
2.0

getRunnable

public IRunnableWithProgress getRunnable()
Returns the runnable that will create the Java project. The runnable will create and open the project if needed. The runnable will add the Java nature to the project, and set the project's classpath and output location.

To create the new java project, execute this runnable

Returns:
the runnable

Eclipse JDT
2.0

Copyright (c) IBM Corp. and others 2000, 2002. All Rights Reserved.