Package org.eclipse.jdt.ui.wizards

# Class JavaCapabilityConfigurationPage

java.lang.Object
org.eclipse.jface.dialogs.DialogPage
org.eclipse.jface.wizard.WizardPage
org.eclipse.jdt.ui.wizards.NewElementWizardPage
org.eclipse.jdt.ui.wizards.JavaCapabilityConfigurationPage

All Implemented Interfaces:
  `org.eclipse.jface.dialogs.IDialogPage`, `org.eclipse.jface.dialogs.IMessageProvider`, `org.eclipse.jface.wizard.IWizardPage`

Direct Known Subclasses:
  `NewJavaProjectWizardPageTwo`

public class JavaCapabilityConfigurationPage extends NewElementWizardPage
Basic wizard page for creating new Java projects. This page can be used in project creation wizards. The page shows UI to configure the project with a Java build path and output location. On finish the page will also configure the Java nature.

This is a replacement for `NewJavaProjectWizardPage` with a cleaner API.

The pages used by the New Java Project wizard are `NewJavaProjectWizardPageOne` and `NewJavaProjectWizardPageTwo`.

Clients may instantiate or subclass.

Since:
  2.0

## Field Summary

### Fields inherited from interface org.eclipse.jface.dialogs.IMessageProvider

`ERROR, INFORMATION, NONE, WARNING`

## Constructor Summary

Constructors
Constructor
Description
`JavaCapabilityConfigurationPage()`
Creates a wizard page that can be used in a Java project creation wizard.

## Method Summary

Modifier and Type
Method
Description
`void`
`configureJavaProject(String newProjectCompliance, org.eclipse.core.runtime.IProgressMonitor monitor)`
Adds the Java nature to the project (if not set yet) and configures the build classpath.
`void`
`configureJavaProject(org.eclipse.core.runtime.IProgressMonitor monitor)`
Adds the Java nature to the project (if not set yet) and configures the build classpath.
`void`
`createControl(org.eclipse.swt.widgets.Composite parent)`
`static void`
`createProject(org.eclipse.core.resources.IProject project, URI locationURI, org.eclipse.core.runtime.IProgressMonitor monitor)`
Helper method to create and open a IProject.
`static void`
`createProject(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IPath locationPath, org.eclipse.core.runtime.IProgressMonitor monitor)`
Deprecated.
use `createProject(IProject, URI, IProgressMonitor)` instead.
`void`
`dispose()`
`IJavaProject`
`getJavaProject()`
Returns the Java project that was passed in `init(IJavaProject, IPath, IClasspathEntry[], boolean)` or `null` if the page has not been initialized yet.
`org.eclipse.core.runtime.IPath`
`getOutputLocation()`
Returns the currently configured output location.
`IClasspathEntry[]`
`getRawClassPath()`
Returns the currently configured classpath.
`org.eclipse.jface.operation.IRunnableWithProgress`
`getRunnable()`
Returns the runnable that will create the Java project or `null` if the page has not been initialized.
`void`
`init(IJavaProject jproject, org.eclipse.core.runtime.IPath defaultOutputLocation, IClasspathEntry[] defaultEntries, boolean defaultsOverrideExistingClasspath)`
Initializes the page with the project and default classpath.
`protected void`
`setFocus()`
Transfers the focus into this page.
`protected boolean`
`useNewSourcePage()`
Clients can override this method to choose if the new source page is used.

### Methods inherited from class org.eclipse.jdt.ui.wizards.NewElementWizardPage

`setVisible, 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, getControl, getDescription, getDialogFontName, getErrorMessage, getFont, getMessage, getMessageType, getTitle, getToolTipText, initializeDialogUnits, isControlCreated, performHelp, setButtonLayoutData, 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

`getControl, getDescription, getErrorMessage, getMessage, getTitle, performHelp`

### Methods inherited from interface org.eclipse.jface.wizard.IWizardPage

`getMinimumPageSize`

## Constructor Details

### JavaCapabilityConfigurationPage

public JavaCapabilityConfigurationPage()
Creates a wizard page that can be used in a Java project creation wizard. It contains UI to configure a the classpath and the output folder.

After constructing, a call to `init(IJavaProject, IPath, IClasspathEntry[], boolean)` is required.

## Method Details

### dispose

public void dispose()

Specified by:
  `dispose` in interface `org.eclipse.jface.dialogs.IDialogPage`
Overrides:
  `dispose` in class `org.eclipse.jface.dialogs.DialogPage`

### useNewSourcePage

protected boolean useNewSourcePage()
Clients can override this method to choose if the new source page is used. The new source page requires that the project is already created as Java project. The page will directly manipulate the classpath. By default `false` is returned.

Returns:
  Returns `true` if the new source page should be used.
Since:
  3.1

### init

public void init(IJavaProject jproject, org.eclipse.core.runtime.IPath defaultOutputLocation, IClasspathEntry[] defaultEntries, boolean defaultsOverrideExistingClasspath)
Initializes the page with the project and default classpath.

The default classpath entries must correspond the given project.

The caller of this method is responsible for creating the underlying project. The page will create the output, source and library folders if required.

The project does not have to exist at the time of initialization, but must exist when executing the runnable obtained by `getRunnable()`.

Parameters:
  `jproject` - The Java project.
  `defaultOutputLocation` - The default classpath entries or `null` to let the page choose the default
  `defaultEntries` - The folder to be taken as the default output path or `null` to let the page choose the default
  `defaultsOverrideExistingClasspath` - If set to `true`, an existing '.classpath' file is ignored. If set to `false` the given default classpath and output location is only used if no '.classpath' exists.

### createControl

public void createControl(org.eclipse.swt.widgets.Composite parent)

### getOutputLocation

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

Returns:
  the currently configured output location

### getRawClassPath

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

Returns:
  the currently configured classpath

### getJavaProject

public IJavaProject getJavaProject()
Returns the Java project that was passed in `init(IJavaProject, IPath, IClasspathEntry[], boolean)` or `null` if the page has not been initialized yet.

Returns:
  the managed Java project or `null`

### getRunnable

public org.eclipse.jface.operation.IRunnableWithProgress getRunnable()
Returns the runnable that will create the Java project or `null` if the page has not been initialized. The runnable sets the project's classpath and output location to the values configured in the page and adds the Java nature if not set yet. The method requires that the project is created and opened.

Returns:
  the runnable that creates the new Java project

### createProject

@Deprecated public static void createProject(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IPath locationPath, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
Deprecated.
use `createProject(IProject, URI, IProgressMonitor)` instead.
Helper method to create and open a IProject. The project location is configured. No natures are added.

Parameters:
  `project` - The handle of the project to create.
  `locationPath` - The location of the project `null` to create the project in the workspace
  `monitor` - a progress monitor to report progress or `null` if progress reporting is not desired
Throws:
  `org.eclipse.core.runtime.CoreException` - if the project couldn't be created
Since:
  2.1

### createProject

public static void createProject(org.eclipse.core.resources.IProject project, URI locationURI, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
Helper method to create and open a IProject. The project location is configured. No natures are added.

Parameters:
  `project` - The handle of the project to create.
  `locationURI` - The location of the project or `null` to create the project in the workspace
  `monitor` - a progress monitor to report progress or `null` if progress reporting is not desired
Throws:
  `org.eclipse.core.runtime.CoreException` - if the project couldn't be created
Since:
  3.2
See Also:
  - `IProjectDescription.setLocationURI(java.net.URI)`

### configureJavaProject

public void configureJavaProject(org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException, InterruptedException
Adds the Java nature to the project (if not set yet) and configures the build classpath.

Parameters:
  `monitor` - a progress monitor to report progress or `null` if progress reporting is not desired
Throws:
  `org.eclipse.core.runtime.CoreException` - Thrown when the configuring the Java project failed.
  `InterruptedException` - Thrown when the operation has been canceled.

### configureJavaProject

public void configureJavaProject(String newProjectCompliance, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException, InterruptedException
Adds the Java nature to the project (if not set yet) and configures the build classpath.

Parameters:
  `newProjectCompliance` - compliance to set for a new project, can be `null`
  `monitor` - a progress monitor to report progress or `null` if progress reporting is not desired
Throws:
  `org.eclipse.core.runtime.CoreException` - Thrown when the configuring the Java project failed.
  `InterruptedException` - Thrown when the operation has been canceled.
Since:
  3.5

### setFocus

protected void setFocus()
Transfers the focus into this page.

Since:
  3.3