public class NewTestCaseWizardPageOne extends NewTypeWizardPage
NewTestCaseWizardPageOne contains controls and validation routines
for the first page of the 'New JUnit TestCase Wizard'.
Clients can use the page as-is and add it to their own wizard, or extend it to modify validation or add and remove controls.
| Modifier and Type | Class and Description |
|---|---|
static class |
NewTestCaseWizardPageOne.JUnitVersion
Available JUnit versions.
|
NewTypeWizardPage.ImportsManager| Modifier and Type | Field and Description |
|---|---|
static String |
CLASS_UNDER_TEST
Field ID of the class under test field.
|
static String |
JUNIT4TOGGLE
Field ID of the JUnit version radio buttons
|
ANNOTATION_TYPE, CLASS_TYPE, ENCLOSING, ENCLOSINGSELECTION, ENUM_TYPE, F_ABSTRACT, F_FINAL, F_PRIVATE, F_PROTECTED, F_PUBLIC, F_STATIC, fEnclosingTypeStatus, fModifierStatus, fPackageStatus, fSuperClassStatus, fSuperInterfacesStatus, fTypeNameStatus, INTERFACE_TYPE, INTERFACES, METHODS, MODIFIERS, PACKAGE, SUPER, TYPENAMECONTAINER, fContainerStatusERROR, INFORMATION, NONE, WARNING| Constructor and Description |
|---|
NewTestCaseWizardPageOne(NewTestCaseWizardPageTwo page2)
Creates a new
NewTestCaseCreationWizardPage. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canFlipToNextPage() |
protected IStatus |
classUnderTestChanged()
Hook method that gets called when the class under test has changed.
|
protected void |
createBuildPathConfigureControls(Composite composite,
int nColumns)
Creates the controls for the JUnit 4 toggle control.
|
protected void |
createClassUnderTestControls(Composite composite,
int nColumns)
Creates the controls for the 'class under test' field.
|
void |
createControl(Composite parent) |
protected void |
createJUnit4Controls(Composite composite,
int nColumns)
Creates the controls for the JUnit version radio buttons.
|
protected void |
createMethodStubSelectionControls(Composite composite,
int nColumns)
Creates the controls for the method stub selection buttons.
|
protected void |
createTypeMembers(IType type,
NewTypeWizardPage.ImportsManager imports,
IProgressMonitor monitor)
Hook method that gets called from
createType to support adding of
unanticipated methods, fields, and inner types to the created type. |
IType |
getClassUnderTest()
Returns the class to be tested.
|
String |
getClassUnderTestText()
Returns the content of the class to test text field.
|
protected String |
getJUnit3TestSuperclassName()
Hook method that is called to determine the name of the superclass set for
a JUnit 3 style test case.
|
NewTestCaseWizardPageOne.JUnitVersion |
getJUnitVersion()
Returns the JUnit version to create the test.
|
int |
getModifiers()
Returns the selected modifiers.
|
protected IStatus[] |
getStatusList()
Returns all status to be consider for the validation.
|
protected void |
handleFieldChanged(String fieldName)
Hook method that gets called when a field on this page has changed.
|
void |
init(IStructuredSelection selection)
Initialized the page with the current selection
|
boolean |
isJUnit4()
Deprecated.
use
getJUnitVersion() instead |
protected IStatus |
packageChanged()
A hook method that gets called when the package field has changed.
|
void |
setClassUnderTest(String name)
Sets the name of the class under test.
|
void |
setEnabled(boolean enabled)
Specifies if the JUnit version radio buttons are enabled.
|
void |
setJUnit4(boolean isJUnit4,
boolean isEnabled)
Deprecated.
use
setJUnitVersion(JUnitVersion) and setEnabled(boolean)
instead |
void |
setJUnitVersion(NewTestCaseWizardPageOne.JUnitVersion version)
Specifies the JUnit version to create the test.
|
void |
setVisible(boolean visible) |
protected IStatus |
superClassChanged()
Hook method that gets called when the superclass name has changed.
|
protected IStatus |
validateIfJUnitProject()
The method is called when the container has changed to validate if the project
is suited for the JUnit test class.
|
addSuperInterface, chooseEnclosingType, choosePackage, chooseSuperClass, chooseSuperInterfaces, constructCUContent, containerChanged, createCommentControls, createEnclosingTypeControls, createInheritedMethods, createModifierControls, createPackageControls, createSeparator, createSuperClassControls, createSuperInterfacesControls, createType, createTypeNameControls, enableCommentControl, enclosingTypeChanged, getCompilationUnitName, getCreatedType, getEnclosingType, getEnclosingTypeLabel, getEnclosingTypeText, getFileComment, getFileComment, getModifiedResource, getModifiersLabel, getPackageFragment, getPackageLabel, getPackageText, getRunnable, getSuperClass, getSuperClassLabel, getSuperInterfaces, getSuperInterfacesLabel, getTemplate, getTemplate, getTypeComment, getTypeComment, getTypeName, getTypeNameLabel, initTypePage, isAddComments, isEnclosingTypeSelected, modifiersChanged, setAddComments, setEnclosingType, setEnclosingTypeSelection, setFocus, setModifiers, setPackageFragment, setSuperClass, setSuperInterfaces, setTypeName, superInterfacesChanged, typeNameChangedchooseContainer, createContainerControls, getContainerLabel, getCurrentTextSelection, getInitialJavaElement, getJavaProject, getMaxFieldWidth, getPackageFragmentRoot, getPackageFragmentRootText, getWorkspaceRoot, initContainerPage, setFocusOnContainer, setPackageFragmentRootupdateStatus, updateStatusgetContainer, getDialogSettings, getImage, getName, getNextPage, getPreviousPage, getShell, getWizard, isCurrentPage, isPageComplete, setDescription, setErrorMessage, setImageDescriptor, setMessage, setPageComplete, setPreviousPage, setTitle, setWizard, toStringconvertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, dispose, getControl, getDescription, getDialogFontName, getErrorMessage, getFont, getMessage, getMessageType, getTitle, getToolTipText, initializeDialogUnits, isControlCreated, performHelp, setButtonLayoutData, setControl, setMessageclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdispose, getControl, getDescription, getErrorMessage, getMessage, getTitle, performHelppublic static final String CLASS_UNDER_TEST
public static final String JUNIT4TOGGLE
public NewTestCaseWizardPageOne(NewTestCaseWizardPageTwo page2)
NewTestCaseCreationWizardPage.page2 - The second pagepublic void init(IStructuredSelection selection)
selection - The selection@Deprecated public void setJUnit4(boolean isJUnit4, boolean isEnabled)
setJUnitVersion(JUnitVersion) and setEnabled(boolean)
insteadisJUnit4 - if set, a JUnit 4 test will be created; otherwise a JUnit 3 test will be
createdisEnabled - if true, the modifier fields are editable; otherwise they are
read-onlypublic void setJUnitVersion(NewTestCaseWizardPageOne.JUnitVersion version)
version - the JUnit versionpublic void setEnabled(boolean enabled)
enabled - if true, the JUnit version radio buttons are enabled; otherwise
they are read-only@Deprecated public boolean isJUnit4()
getJUnitVersion() insteadtrue if the test should be created as Junit 4 testtrue if the test should be created as Junit 4 testpublic NewTestCaseWizardPageOne.JUnitVersion getJUnitVersion()
protected void handleFieldChanged(String fieldName)
NewContainerWizardPageEvery 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).
handleFieldChanged in class NewTypeWizardPagefieldName - The name of the field that has changed (field id). For the
source folder the field id is CONTAINERprotected IStatus[] getStatusList()
public void createControl(Composite parent)
protected void createMethodStubSelectionControls(Composite composite, int nColumns)
GridLayout with
at least 3 columns.composite - the parent compositenColumns - number of columns to spanprotected void createClassUnderTestControls(Composite composite, int nColumns)
GridLayout with
at least 3 columns.composite - the parent compositenColumns - number of columns to spanprotected void createJUnit4Controls(Composite composite, int nColumns)
GridLayout with
at least 3 columns.composite - the parent compositenColumns - number of columns to spanprotected void createBuildPathConfigureControls(Composite composite, int nColumns)
GridLayout with
at least 3 columns.composite - the parent compositenColumns - number of columns to spanprotected IStatus packageChanged()
NewTypeWizardPageSubclasses may extend this method to perform their own validation.
packageChanged in class NewTypeWizardPageprotected IStatus classUnderTestChanged()
Subclasses may extend this method to perform their own validation.
public String getClassUnderTestText()
public IType getClassUnderTest()
null if the entered values are not validpublic void setClassUnderTest(String name)
name - The name to setprotected void createTypeMembers(IType type, NewTypeWizardPage.ImportsManager imports, IProgressMonitor monitor) throws CoreException
NewTypeWizardPagecreateType to support adding of
unanticipated methods, fields, and inner types to the created type.
Implementers can use any methods defined on IType to manipulate the
new type.
The source code of the new type will be formatted using the platform's formatter. Needed imports are added by the wizard at the end of the type creation process using the given import manager.
createTypeMembers in class NewTypeWizardPagetype - the new type created via createTypeimports - an import manager which can be used to add new importsmonitor - a progress monitor to report progress. Must not be nullCoreException - thrown when creation of the type members failedNewTypeWizardPage.createType(IProgressMonitor)public void setVisible(boolean visible)
setVisible in interface IDialogPagesetVisible in class NewElementWizardPageprotected IStatus validateIfJUnitProject()
protected IStatus superClassChanged()
NewTypeWizardPageSubclasses may extend this method to perform their own validation.
superClassChanged in class NewTypeWizardPagepublic boolean canFlipToNextPage()
canFlipToNextPage in interface IWizardPagecanFlipToNextPage in class WizardPageprotected String getJUnit3TestSuperclassName()
public int getModifiers()
NewTypeWizardPagegetModifiers in class NewTypeWizardPageFlags
Copyright (c) 2000, 2017 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.