public abstract class NewContainerWizardPage extends NewElementWizardPage
Clients may 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.Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
CONTAINER
Id of the container field
|
protected IStatus |
fContainerStatus
The status of the last validation.
|
Constructor and Description |
---|
NewContainerWizardPage(java.lang.String name)
Create a new
NewContainerWizardPage |
Modifier and Type | Method and Description |
---|---|
protected IPackageFragmentRoot |
chooseContainer()
Opens a selection dialog that allows to select a source container.
|
protected IStatus |
containerChanged()
This method is a hook which gets called after the source folder's
text input field has changed.
|
protected void |
createContainerControls(Composite parent,
int nColumns)
Creates the necessary controls (label, text field and browse button) to edit
the source folder location.
|
protected java.lang.String |
getContainerLabel()
Returns the label that is used for the container input field.
|
protected ITextSelection |
getCurrentTextSelection()
Returns the text selection of the current editor.
|
protected IJavaScriptElement |
getInitialJavaElement(IStructuredSelection selection)
Utility method to inspect a selection to find a JavaScript element.
|
IJavaScriptProject |
getJavaProject()
Returns the JavaScript project of the currently selected package fragment root or
null
if no package fragment root is configured. |
protected int |
getMaxFieldWidth()
Returns the recommended maximum width for text fields (in pixels).
|
IPackageFragmentRoot |
getPackageFragmentRoot()
Returns the
IPackageFragmentRoot that corresponds to the current
value of the source folder field. |
java.lang.String |
getPackageFragmentRootText()
Returns the current text of source folder text field.
|
protected IWorkspaceRoot |
getWorkspaceRoot()
Returns the workspace root.
|
protected void |
handleFieldChanged(java.lang.String fieldName)
Hook method that gets called when a field on this page has changed.
|
protected void |
initContainerPage(IJavaScriptElement elem)
Initializes the source folder field with a valid package fragment root.
|
protected void |
setFocusOnContainer()
Sets the focus to the source folder's text field.
|
void |
setPackageFragmentRoot(IPackageFragmentRoot root,
boolean canBeModified)
Sets the current source folder (model and text field) to the given package
fragment root.
|
setVisible, updateStatus, updateStatus
protected static final java.lang.String CONTAINER
protected IStatus fContainerStatus
public NewContainerWizardPage(java.lang.String name)
NewContainerWizardPage
name
- the wizard page's nameprotected java.lang.String getContainerLabel()
protected void initContainerPage(IJavaScriptElement elem)
elem
- the JavaScript element used to compute the initial package
fragment root used as the source folderprotected IJavaScriptElement getInitialJavaElement(IStructuredSelection selection)
selection
- the selection to be inspectednull
,
if no JavaScript element exists in the given selectionprotected ITextSelection getCurrentTextSelection()
null
is returned
when the current editor does not have focus or does not return a text selection.null
.protected int getMaxFieldWidth()
protected void createContainerControls(Composite parent, int nColumns)
GridLayout
as its layout manager and that the
grid layout has at least 3 columns.parent
- the parent compositenColumns
- the number of columns to span. This number must be
greater or equal threeprotected void setFocusOnContainer()
protected IStatus containerChanged()
protected void handleFieldChanged(java.lang.String fieldName)
Every sub type is responsible to call this method when a field on its page has changed. Subtypes override (extend) the method to add verification when a own field has a dependency to an other field. For example the class name input must be verified again when the package field changes (check for duplicated class names).
fieldName
- The name of the field that has changed (field id). For the
source folder the field id is CONTAINER
protected IWorkspaceRoot getWorkspaceRoot()
public IJavaScriptProject getJavaProject()
null
if no package fragment root is configured.null
.public IPackageFragmentRoot getPackageFragmentRoot()
IPackageFragmentRoot
that corresponds to the current
value of the source folder field.null
if the current source
folder value is not a valid package fragment rootpublic java.lang.String getPackageFragmentRootText()
public void setPackageFragmentRoot(IPackageFragmentRoot root, boolean canBeModified)
root
- The new root.canBeModified
- if false
the source folder field can
not be changed by the user. If true
the field is editableprotected IPackageFragmentRoot chooseContainer()
null
if the dialog has been canceled.
The caller typically sets the result to the container input field.
Clients can override this method if they want to offer a different dialog.
Copyright (c) IBM Corp. and others 2000, 2016. All Rights Reserved.