Bug 28720 Creating a JUnit TestCase gives an error
Whenever I upgrade Eclipse, I always rename the old version to eclipse.old and install in a new directory called eclipse and then copy in my previous WorkSpace from eclipse.old. Everything works fine except when I try to create a JUnit TestCase. The TestCase itself is created but the wizard puts up an error dialog with title "New" saying: Creation of element failed. Reason: TestFileUtilities [in Working copy] TestFileUtilities.java [in com.teamphone.common.io [in source\java\TPWeb [in TPWeb]]]] does not exist. I have currently got the M4 build and this also happened when I upgraded to M3. The contents of the log are: !SESSION Dec 20, 2002 10:19:24.283 --------------------------------------------- java.version=1.3.1_02 java.vendor=Sun Microsystems Inc. BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_GB Command-line arguments: -os win32 -ws win32 -arch x86 -install file:D:/eclipse/ !ENTRY org.eclipse.jdt.junit 4 4 Dec 20, 2002 10:19:24.283 !MESSAGE Error !STACK 1 Java Model Exception: Java Model Status [TestFileUtilities [in [Working copy] TestFileUtilities.java [in com.teamphone.common.io [in source/java/TPWeb [in TPWeb]]]] does not exist.] at org.eclipse.jdt.internal.core.JavaElement.newNotPresentException (JavaElement.java:488) at org.eclipse.jdt.internal.core.JavaElement.getElementInfo (JavaElement.java:299) at org.eclipse.jdt.internal.core.JavaElement.getChildren (JavaElement.java:252) at org.eclipse.jdt.internal.core.JavaElement.getChildrenOfType (JavaElement.java:261) at org.eclipse.jdt.internal.core.SourceType.getMethods (SourceType.java:212) at org.eclipse.jdt.internal.junit.wizards.NewTestCaseCreationWizardPage.createTaskM arkers(NewTestCaseCreationWizardPage.java:658) at org.eclipse.jdt.internal.junit.wizards.NewTestCaseCreationWizardPage.createType (NewTestCaseCreationWizardPage.java:652) at org.eclipse.jdt.ui.wizards.NewTypeWizardPage$1.run (NewTypeWizardPage.java:1671) at org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation.execute (WorkspaceModifyDelegatingOperation.java:39) at org.eclipse.ui.actions.WorkspaceModifyOperation$1.run (WorkspaceModifyOperation.java:65) at org.eclipse.core.internal.resources.Workspace.run (Workspace.java:1564) at org.eclipse.ui.actions.WorkspaceModifyOperation.run (WorkspaceModifyOperation.java:79) at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:296) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:246) at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java:716) at org.eclipse.jdt.internal.junit.wizards.JUnitWizard.finishPage (JUnitWizard.java:45) at org.eclipse.jdt.internal.junit.wizards.NewTestCaseCreationWizard.performFinish (NewTestCaseCreationWizard.java:55) at org.eclipse.jface.wizard.WizardDialog.finishPressed (WizardDialog.java:570) at org.eclipse.jface.wizard.WizardDialog.buttonPressed (WizardDialog.java:308) at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:398) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java:87) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:825) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1692) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1410) at org.eclipse.jface.window.Window.runEventLoop(Window.java:561) at org.eclipse.jface.window.Window.open(Window.java:541) at org.eclipse.ui.actions.NewWizardAction.run(NewWizardAction.java:109) at org.eclipse.jface.action.Action.runWithEvent(Action.java:769) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:411) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent (ActionContributionItem.java:365) at org.eclipse.jface.action.ActionContributionItem.access$0 (ActionContributionItem.java:356) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java:48) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:825) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1692) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1410) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1446) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1429) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:845) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:462) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539) !ENTRY org.eclipse.jdt.core 4 969 Dec 20, 2002 10:19:24.283 !MESSAGE TestFileUtilities [in [Working copy] TestFileUtilities.java [in com.teamphone.common.io [in source/java/TPWeb [in TPWeb]]]] does not exist.
org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/wizards/NewTestCaseCreationWizardPage.java
int nColumns= 4;
		
		GridLayout layout= new GridLayout();
		layout.numColumns= nColumns;		
		composite.setLayout(layout);
		createContainerControls(composite, nColumns);	
		createPackageControls(composite, nColumns);		
		createSeparator(composite, nColumns);
		createTestClassControls(composite, nColumns);		
		createClassToTestControls(composite, nColumns);
		createSuperClassControls(composite, nColumns);
		createMethodStubSelectionControls(composite, nColumns);
		setSuperClass(JUnitPlugin.TEST_SUPERCLASS_NAME, true);
		
		setControl(composite);
			
		
		fClassToTestText.setText(fDefaultClassToTest);
		restoreWidgetValues();
		WorkbenchHelp.setHelp(composite, IJUnitHelpContextIds.NEW_TESTCASE_WIZARD_PAGE);	
	}
	protected void createMethodStubSelectionControls(Composite composite, int nColumns) {
		LayoutUtil.setHorizontalSpan(fMethodStubsButtons.getLabelControl(composite), nColumns);
		LayoutUtil.createEmptySpace(composite,1);
		LayoutUtil.setHorizontalSpan(fMethodStubsButtons.getSelectionButtonsGroup(composite), nColumns - 1);	
	}	
	protected void createClassToTestControls(Composite composite, int nColumns) {
		fClassToTestLabel= new Label(composite, SWT.LEFT | SWT.WRAP);
		fClassToTestLabel.setFont(composite.getFont());