Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 178700 Details for
Bug 275574
[JUnit] Superclass entry is unnecessarily disabled for new JUnit Test Case Wizard
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch committed
patch3_275574.txt (text/plain), 3.42 KB, created by
Raksha Vasisht
on 2010-09-12 05:27:13 EDT
(
hide
)
Description:
patch committed
Filename:
MIME Type:
Creator:
Raksha Vasisht
Created:
2010-09-12 05:27:13 EDT
Size:
3.42 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.junit >Index: src/org/eclipse/jdt/junit/wizards/NewTestCaseWizardPageOne.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseWizardPageOne.java,v >retrieving revision 1.37 >diff -u -r1.37 NewTestCaseWizardPageOne.java >--- src/org/eclipse/jdt/junit/wizards/NewTestCaseWizardPageOne.java 15 Aug 2010 23:21:16 -0000 1.37 >+++ src/org/eclipse/jdt/junit/wizards/NewTestCaseWizardPageOne.java 12 Sep 2010 09:19:12 -0000 >@@ -159,6 +159,13 @@ > private Label fImage; > > /** >+ * Indicates whether the super class field was explicitly modified by the user. >+ * >+ * @since 3.7 >+ */ >+ private boolean fSuperClassExplicitlySet= false; >+ >+ /** > * Creates a new <code>NewTestCaseCreationWizardPage</code>. > * @param page2 The second page > * >@@ -249,6 +256,8 @@ > } > } > setJUnit4(isJunit4, true); >+ setSuperClass(getDefaultSuperClassName(), true); >+ fSuperClassExplicitlySet= false; //set to false when default value is set > > updateStatus(getStatusList()); > } >@@ -288,11 +297,11 @@ > private void internalSetJUnit4(boolean isJUnit4) { > fIsJunit4= isJUnit4; > fJunit4Status= junit4Changed(); >- if (fIsJunit4) { >- setSuperClass("java.lang.Object", false); //$NON-NLS-1$ >- } else { >- setSuperClass(getJUnit3TestSuperclassName(), true); >+ if (!fSuperClassExplicitlySet || getSuperClass().trim().equals("")) { //$NON-NLS-1$ >+ setSuperClass(getDefaultSuperClassName(), true); >+ fSuperClassExplicitlySet= false; //set back to false when default value is set > } >+ fSuperClassStatus= superClassChanged(); //validate superclass field when toggled > handleFieldChanged(JUNIT4TOGGLE); > } > >@@ -315,6 +324,8 @@ > fMethodStubsButtons.setEnabled(IDX_SETUP_CLASS, isJUnit4()); > fMethodStubsButtons.setEnabled(IDX_TEARDOWN_CLASS, isJUnit4()); > fMethodStubsButtons.setEnabled(IDX_CONSTRUCTOR, !isJUnit4()); >+ } else if (fieldName.equals(SUPER)) { >+ fSuperClassExplicitlySet= true; > } > updateStatus(getStatusList()); > } >@@ -1085,17 +1096,17 @@ > */ > @Override > protected IStatus superClassChanged() { >- // replaces the super class validation of of the normal type wizard >- if (isJUnit4()) { >- return new JUnitStatus(); >- } >- >+ super.superClassChanged(); > String superClassName= getSuperClass(); > JUnitStatus status= new JUnitStatus(); >+ boolean isJUnit4= isJUnit4(); > if (superClassName == null || superClassName.trim().equals("")) { //$NON-NLS-1$ >- status.setError(WizardMessages.NewTestCaseWizardPageOne_error_superclass_empty); >+ if (!isJUnit4) >+ status.setError(WizardMessages.NewTestCaseWizardPageOne_error_superclass_empty); > return status; > } >+ if (isJUnit4 && superClassName.equals("java.lang.Object")) //$NON-NLS-1$ >+ return status; > if (getPackageFragmentRoot() != null) { > try { > IType type= resolveClassNameToType(getPackageFragmentRoot().getJavaProject(), getPackageFragment(), superClassName); >@@ -1195,4 +1206,14 @@ > return JUnitCorePlugin.TEST_SUPERCLASS_NAME; > } > >+ /** >+ * Returns the default value for the super class field. >+ * >+ * @return the default value for the super class field >+ * @since 3.7 >+ */ >+ private String getDefaultSuperClassName() { >+ return isJUnit4() ? "java.lang.Object" : getJUnit3TestSuperclassName(); //$NON-NLS-1$ >+ } >+ > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 275574
:
176299
| 178700