public class JavaCapabilityConfigurationPage extends NewElementWizardPage
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.
ERROR, INFORMATION, NONE, WARNING
Constructor and Description |
---|
JavaCapabilityConfigurationPage()
Creates a wizard page that can be used in a Java project creation wizard.
|
Modifier and Type | Method and Description |
---|---|
void |
configureJavaProject(IProgressMonitor monitor)
Adds the Java nature to the project (if not set yet) and configures the build classpath.
|
void |
configureJavaProject(String newProjectCompliance,
IProgressMonitor monitor)
Adds the Java nature to the project (if not set yet) and configures the build classpath.
|
void |
createControl(Composite parent) |
static void |
createProject(IProject project,
IPath locationPath,
IProgressMonitor monitor)
Deprecated.
use
createProject(IProject, URI, IProgressMonitor) instead. |
static void |
createProject(IProject project,
URI locationURI,
IProgressMonitor monitor)
Helper method to create and open a IProject.
|
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. |
IPath |
getOutputLocation()
Returns the currently configured output location.
|
IClasspathEntry[] |
getRawClassPath()
Returns the currently configured classpath.
|
IRunnableWithProgress |
getRunnable()
Returns the runnable that will create the Java project or
null if the page has
not been initialized. |
void |
init(IJavaProject jproject,
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.
|
setVisible, updateStatus, updateStatus
canFlipToNextPage, getContainer, getDialogSettings, getImage, getName, getNextPage, getPreviousPage, getShell, getWizard, isCurrentPage, isPageComplete, setDescription, setErrorMessage, setImageDescriptor, setMessage, setPageComplete, setPreviousPage, setTitle, setWizard, toString
convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, getControl, getDescription, getDialogFontName, getErrorMessage, getFont, getMessage, getMessageType, getTitle, getToolTipText, initializeDialogUnits, isControlCreated, performHelp, setButtonLayoutData, setControl, setMessage
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getControl, getDescription, getErrorMessage, getMessage, getTitle, performHelp
public JavaCapabilityConfigurationPage()
After constructing, a call to init(IJavaProject, IPath, IClasspathEntry[], boolean)
is required.
public void dispose()
dispose
in interface IDialogPage
dispose
in class DialogPage
protected boolean useNewSourcePage()
false
is returned.true
if the new source page should be used.public void init(IJavaProject jproject, IPath defaultOutputLocation, IClasspathEntry[] defaultEntries, boolean defaultsOverrideExistingClasspath)
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()
.
jproject
- The Java project.defaultOutputLocation
- The default classpath entries or null
to let the page choose the defaultdefaultEntries
- The folder to be taken as the default output path or null
to let the page choose the defaultdefaultsOverrideExistingClasspath
- 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.public void createControl(Composite parent)
public IPath getOutputLocation()
public IClasspathEntry[] getRawClassPath()
public IJavaProject getJavaProject()
init(IJavaProject, IPath, IClasspathEntry[], boolean)
or null
if the
page has not been initialized yet.null
public IRunnableWithProgress getRunnable()
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.public static void createProject(IProject project, IPath locationPath, IProgressMonitor monitor) throws CoreException
createProject(IProject, URI, IProgressMonitor)
instead.project
- The handle of the project to create.locationPath
- The location of the project null
to create the project in the workspacemonitor
- a progress monitor to report progress or null
if
progress reporting is not desiredCoreException
- if the project couldn't be createdpublic static void createProject(IProject project, URI locationURI, IProgressMonitor monitor) throws CoreException
project
- The handle of the project to create.locationURI
- The location of the project or null
to create the project in the workspacemonitor
- a progress monitor to report progress or null
if
progress reporting is not desiredCoreException
- if the project couldn't be createdIProjectDescription.setLocationURI(java.net.URI)
public void configureJavaProject(IProgressMonitor monitor) throws CoreException, InterruptedException
monitor
- a progress monitor to report progress or null
if
progress reporting is not desiredCoreException
- Thrown when the configuring the Java project failed.InterruptedException
- Thrown when the operation has been canceled.public void configureJavaProject(String newProjectCompliance, IProgressMonitor monitor) throws CoreException, InterruptedException
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 desiredCoreException
- Thrown when the configuring the Java project failed.InterruptedException
- Thrown when the operation has been canceled.protected void setFocus()
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.