org.eclipse.wst.jsdt.ui.wizards
Class JavaCapabilityConfigurationPage

java.lang.Object
  extended by WizardPage
      extended by org.eclipse.wst.jsdt.ui.wizards.NewElementWizardPage
          extended by org.eclipse.wst.jsdt.ui.wizards.JavaCapabilityConfigurationPage

public class JavaCapabilityConfigurationPage
extends NewElementWizardPage

Standard wizard page for creating new JavaScript projects. This page can be used in project creation wizards. The page shows UI to configure the project with a JavaScript build path and output location. On finish the page will also configure the JavaScript nature.

This is a replacement for NewJavaProjectWizardPage with a cleaner API.

Clients may instantiate or subclass.

Provisional API: This class/interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.


Constructor Summary
JavaCapabilityConfigurationPage()
          Creates a wizard page that can be used in a JavaScript project creation wizard.
 
Method Summary
 void configureJavaProject(IProgressMonitor monitor)
          Adds the JavaScript nature to the project (if not set yet) and configures the build classpath.
 void createControl(Composite parent)
           
static void createProject(IProject project, java.net.URI locationURI, IProgressMonitor monitor)
          Helper method to create and open a IProject.
 void dispose()
           
 IJavaScriptProject getJavaProject()
          Returns the JavaScript project that was passed in #init(IJavaScriptProject, IPath, IIncludePathEntry[], boolean) or null if the page has not been initialized yet.
 IPath getOutputLocation()
          Returns the currently configured output location.
 IIncludePathEntry[] getRawClassPath()
          Returns the currently configured classpath.
 IRunnableWithProgress getRunnable()
          Returns the runnable that will create the JavaScript project or null if the page has not been initialized.
 void init(IJavaScriptProject jproject, IIncludePathEntry[] defaultEntries, boolean defaultsOverrideExistingClasspath)
          Initializes the page with the project and default classpath.
 
Methods inherited from class org.eclipse.wst.jsdt.ui.wizards.NewElementWizardPage
setVisible
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaCapabilityConfigurationPage

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

After constructing, a call to #init(IJavaScriptProject, IPath, IIncludePathEntry[], boolean) is required.

Method Detail

dispose

public void dispose()

init

public void init(IJavaScriptProject jproject,
                 IIncludePathEntry[] 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 JavaScript 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(Composite parent)

getOutputLocation

public 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 IIncludePathEntry[] getRawClassPath()
Returns the currently configured classpath. Note that the classpath might not be valid.

Returns:
the currently configured classpath

getJavaProject

public IJavaScriptProject getJavaProject()
Returns the JavaScript project that was passed in #init(IJavaScriptProject, IPath, IIncludePathEntry[], boolean) or null if the page has not been initialized yet.

Returns:
the managed JavaScript project or null

getRunnable

public IRunnableWithProgress getRunnable()
Returns the runnable that will create the JavaScript 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 JavaScript nature if not set yet. The method requires that the project is created and opened.

Returns:
the runnable that creates the new JavaScript project

createProject

public static void createProject(IProject project,
                                 java.net.URI locationURI,
                                 IProgressMonitor monitor)
                          throws 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:
CoreException - if the project couldn't be created
See Also:
org.eclipse.core.resources.IProjectDescription#setLocationURI(java.net.URI)

configureJavaProject

public void configureJavaProject(IProgressMonitor monitor)
                          throws CoreException,
                                 java.lang.InterruptedException
Adds the JavaScript 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:
CoreException - Thrown when the configuring the JavaScript project failed.
java.lang.InterruptedException - Thrown when the operation has been canceled.