Bug 443309: tearDownAfterClass() in NewTestCaseCreationWizard gets disabled when something else is clicked on
diff --git a/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/wizards/MethodStubsSelectionButtonGroup.java b/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/wizards/MethodStubsSelectionButtonGroup.java
index bfa5a5d..83fb63f 100644
--- a/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/wizards/MethodStubsSelectionButtonGroup.java
+++ b/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/wizards/MethodStubsSelectionButtonGroup.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,7 +18,6 @@
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
@@ -35,8 +34,6 @@
private Label fLabel;
protected String fLabelText;
- private SelectionButtonGroupListener fGroupListener;
-
private boolean fEnabled;
private Composite fButtonComposite;
@@ -50,15 +47,6 @@
private int fGroupNumberOfColumns;
private int fButtonsStyle;
-
- public interface SelectionButtonGroupListener {
- /**
- * The dialog field has changed.
- * @param field The changed dialog field
- */
- void groupChanged(MethodStubsSelectionButtonGroup field);
- }
-
/**
* Creates a group without border.
* @param buttonsStyle one of {@link SWT#RADIO}, {@link SWT#CHECK}, or {@link SWT#TOGGLE}
@@ -179,33 +167,15 @@
for (int i= 0; i < nFillElements; i++) {
createEmptySpace(fButtonComposite);
}
- setSelectionGroupListener(new SelectionButtonGroupListener() {
- public void groupChanged(MethodStubsSelectionButtonGroup field) {
- field.setEnabled(1, isEnabled() && field.isSelected(0));
- }
- });
}
return fButtonComposite;
}
- /**
- * Returns a button from the group or <code>null</code> if not yet created.
- * @param index the button index
- * @return the button
- */
- public Button getSelectionButton(int index) {
- if (index >= 0 && index < fButtons.length) {
- return fButtons[index];
- }
- return null;
- }
-
protected void doWidgetSelected(SelectionEvent e) {
Button button= (Button)e.widget;
for (int i= 0; i < fButtons.length; i++) {
if (fButtons[i] == button) {
fButtonsSelected[i]= button.getSelection();
- dialogFieldChanged();
return;
}
}
@@ -297,49 +267,6 @@
fLabelText= labeltext;
}
- /**
- * Defines the listener for this dialog field.
- * @param listener the listener
- */
- public final void setSelectionGroupListener(SelectionButtonGroupListener listener) {
- fGroupListener= listener;
- }
-
- /**
- * A dialog field has changed.
- */
- public void dialogFieldChanged() {
- if (fGroupListener != null) {
- fGroupListener.groupChanged(this);
- }
- }
-
- /**
- * Tries to set the focus to the dialog field.
- * Returns <code>true</code> if the dialog field can take focus.
- * To be re-implemented by dialog field implementors.
- * @return returns <code>true</code> if the dialog field can take focus
- */
- public boolean setFocus() {
- return false;
- }
-
- /**
- * Posts <code>setFocus</code> to the display event queue.
- * @param display the display
- */
- public void postSetFocusOnDialogField(Display display) {
- if (display != null) {
- display.asyncExec(
- new Runnable() {
- public void run() {
- setFocus();
- }
- }
- );
- }
- }
-
protected static GridData gridDataForLabel(int span) {
GridData gd= new GridData();
gd.horizontalSpan= span;
diff --git a/org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseWizardPageOne.java b/org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseWizardPageOne.java
index 0deb8ce..09b3b9b 100644
--- a/org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseWizardPageOne.java
+++ b/org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseWizardPageOne.java
@@ -334,7 +334,7 @@
} else if (fieldName.equals(JUNIT4TOGGLE)) {
updateBuildPathMessage();
fMethodStubsButtons.setEnabled(IDX_SETUP_CLASS, isJUnit4());
- fMethodStubsButtons.setEnabled(IDX_TEARDOWN_CLASS, isJUnit4() && fMethodStubsButtons.isSelected(IDX_SETUP_CLASS));
+ fMethodStubsButtons.setEnabled(IDX_TEARDOWN_CLASS, isJUnit4());
fMethodStubsButtons.setEnabled(IDX_CONSTRUCTOR, !isJUnit4());
}
updateStatus(getStatusList());