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 176299 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
patch2_275574.txt (text/plain), 4.64 KB, created by
Raksha Vasisht
on 2010-08-11 03:38:18 EDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Raksha Vasisht
Created:
2010-08-11 03:38:18 EDT
Size:
4.64 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.35 >diff -u -r1.35 NewTestCaseWizardPageOne.java >--- src/org/eclipse/jdt/junit/wizards/NewTestCaseWizardPageOne.java 22 Jun 2010 15:51:02 -0000 1.35 >+++ src/org/eclipse/jdt/junit/wizards/NewTestCaseWizardPageOne.java 11 Aug 2010 06:45:02 -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) { >+ setSuperClass(getDefaultSuperClassName(), true); >+ fSuperClassExplicitlySet= false; //set back to false when default value is set > } >+ fSuperClassStatus= superClassChanged(); //validate superclass field when toggled > handleFieldChanged(JUNIT4TOGGLE); > } > >@@ -314,6 +323,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()); > } >@@ -1079,17 +1090,17 @@ > * @see org.eclipse.jdt.ui.wizards.NewTypeWizardPage#superClassChanged() > */ > protected IStatus superClassChanged() { >- // replaces the super class validation of of the normal type wizard >- if (isJUnit4()) { >- return new JUnitStatus(); >- } >- >+ enableBrowseButtonForSuperClass(); > 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); >@@ -1188,4 +1199,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$ >+ } >+ > } >#P org.eclipse.jdt.ui >Index: ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java,v >retrieving revision 1.197 >diff -u -r1.197 NewTypeWizardPage.java >--- ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java 27 May 2010 08:17:24 -0000 1.197 >+++ ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java 11 Aug 2010 06:45:12 -0000 >@@ -1672,7 +1672,7 @@ > protected IStatus superClassChanged() { > StatusInfo status= new StatusInfo(); > IPackageFragmentRoot root= getPackageFragmentRoot(); >- fSuperClassDialogField.enableButton(root != null); >+ enableBrowseButtonForSuperClass(); > > fSuperClassStubTypeContext= null; > >@@ -1698,6 +1698,15 @@ > return status; > } > >+ /** >+ * Sets the enable state of the browse button for super class dialog field. >+ * >+ * @since 3.7 >+ */ >+ protected void enableBrowseButtonForSuperClass() { >+ fSuperClassDialogField.enableButton(getPackageFragmentRoot() != null); >+ } >+ > private StubTypeContext getSuperClassStubTypeContext() { > if (fSuperClassStubTypeContext == null) { > String typeName;
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