Bug 12108 NewTypeWizardPage hard to use in non-existing java project
I use the NewTypeWizardPage to create a type in a java project that does not exist. To achieve this, I override methods containerChanged() and packageChanged() with implementations that only return new Status(). Note that hthis class is in an internal package. I would like to validate the package name that the user enters, but for non-existing java projects, packageChanged() always logs the following exception: 4 org.eclipse.jdt.ui 1 Internal Error Java Model Exception: Java Model Status [B does not exist.] Stack trace: java/lang/Throwable.<init>()V java/lang/Throwable.<init>(Ljava/lang/String;)V org/eclipse/core/runtime/CoreException.<init>(Lorg/eclipse/core/runtime/IStatus;)V org/eclipse/jdt/core/JavaModelException.<init>(Lorg/eclipse/jdt/core/IJavaModelStatus;)V org/eclipse/jdt/internal/core/JavaElement.newNotPresentException()Lorg/eclipse/jdt/core/JavaModelException; org/eclipse/jdt/internal/core/JavaProject.openWhenClosed(Lorg/eclipse/core/runtime/IProgressMonitor;Lorg/eclipse/jdt/core/IBuffer;)V org/eclipse/jdt/internal/core/JavaElement.openHierarchy()V org/eclipse/jdt/internal/core/JavaElement.getElementInfo()Lorg/eclipse/jdt/internal/core/JavaElementInfo; org/eclipse/jdt/internal/core/JavaProject.getJavaProjectElementInfo()Lorg/eclipse/jdt/internal/core/JavaProjectElementInfo; org/eclipse/jdt/internal/core/JavaProject.getOutputLocation()Lorg/eclipse/core/runtime/IPath; org/eclipse/jdt/ui/wizards/NewTypeWizardPage.packageChanged()Lorg/eclipse/core/runtime/IStatus; org/eclipse/jdt/ui/wizards/NewTypeWizardPage.handleFieldChanged(Ljava/lang/String;)V org/eclipse/jdt/ui/wizards/NewContainerWizardPage.containerDialogFieldChanged(Lorg/eclipse/jdt/internal/ui/wizards/dialogfields/DialogField;)V org/eclipse/jdt/ui/wizards/NewContainerWizardPage.access$1(Lorg/eclipse/jdt/ui/wizards/NewContainerWizardPage;Lorg/eclipse/jdt/internal/ui/wizards/dialogfields/DialogField;)V org/eclipse/jdt/ui/wizards/NewContainerWizardPage$ContainerFieldAdapter.dialogFieldChanged(Lorg/eclipse/jdt/internal/ui/wizards/dialogfields/DialogField;)V org/eclipse/jdt/internal/ui/wizards/dialogfields/DialogField.dialogFieldChanged()V org/eclipse/jdt/internal/ui/wizards/dialogfields/StringDialogField.setText(Ljava/lang/String;)V org/eclipse/jdt/ui/wizards/NewContainerWizardPage.setPackageFragmentRoot(Lorg/eclipse/jdt/core/IPackageFragmentRoot;Z)V com/ibm/ive/jxe/newwizards/InnerClassCreationPage.setProject(Lorg/eclipse/jdt/core/IJavaProject;)V com/ibm/ive/midp/wizard/MIDletSuitePage.projectUpdated()V com/ibm/ive/midp/wizard/MIDletSuitePage.access$0(Lcom/ibm/ive/midp/wizard/MIDletSuitePage;)V com/ibm/ive/midp/wizard/MIDletSuitePage$1.modifyText(Lorg/eclipse/swt/events/ModifyEvent;)V org/eclipse/swt/widgets/TypedListener.handleEvent(Lorg/eclipse/swt/widgets/Event;)V org/eclipse/swt/widgets/EventTable.sendEvent(Lorg/eclipse/swt/widgets/Event;)V org/eclipse/swt/widgets/Widget.sendEvent(ILorg/eclipse/swt/widgets/Event;)V org/eclipse/swt/widgets/Widget.sendEvent(I)V org/eclipse/swt/widgets/Text.wmCommandChild(II)Lorg/eclipse/swt/internal/win32/LRESULT; org/eclipse/swt/widgets/Control.WM_COMMAND(II)Lorg/eclipse/swt/internal/win32/LRESULT; org/eclipse/swt/widgets/Control.windowProc(III)I org/eclipse/swt/widgets/Display.windowProc(IIII)I org/eclipse/swt/internal/win32/OS.CallWindowProcW(IIIII)I org/eclipse/swt/internal/win32/OS.CallWindowProc(IIIII)I org/eclipse/swt/widgets/Text.callWindowProc(III)I org/eclipse/swt/widgets/Control.windowProc(III)I org/eclipse/swt/widgets/Display.windowProc(IIII)I org/eclipse/swt/internal/win32/OS.DispatchMessageW(Lorg/eclipse/swt/internal/win32/MSG;)I org/eclipse/swt/internal/win32/OS.DispatchMessage(Lorg/eclipse/swt/internal/win32/MSG;)I org/eclipse/swt/widgets/Display.readAndDispatch()Z org/eclipse/jface/window/Window.runEventLoop(Lorg/eclipse/swt/widgets/Shell;)V org/eclipse/jface/window/Window.open()I org/eclipse/ui/actions/NewWizardAction.run()V org/eclipse/ui/internal/NewWizardDropDownAction.run()V org/eclipse/jface/action/Action.runWithEvent(Lorg/eclipse/swt/widgets/Event;)V org/eclipse/jface/action/ActionContributionItem.handleWidgetSelection(Lorg/eclipse/swt/widgets/Event;)V org/eclipse/jface/action/ActionContributionItem.handleWidgetEvent(Lorg/eclipse/swt/widgets/Event;)V org/eclipse/jface/action/ActionContributionItem.access$0(Lorg/eclipse/jface/action/ActionContributionItem;Lorg/eclipse/swt/widgets/Event;)V org/eclipse/jface/action/ActionContributionItem$ActionListener.handleEvent(Lorg/eclipse/swt/widgets/Event;)V org/eclipse/swt/widgets/EventTable.sendEvent(Lorg/eclipse/swt/widgets/Event;)V org/eclipse/swt/widgets/Widget.notifyListeners(ILorg/eclipse/swt/widgets/Event;)V org/eclipse/swt/widgets/Display.runDeferredEvents()Z org/eclipse/swt/widgets/Display.readAndDispatch()Z org/eclipse/ui/internal/Workbench.runEventLoop()V org/eclipse/ui/internal/Workbench.run(Ljava/lang/Object;)Ljava/lang/Object; org/eclipse/core/internal/boot/InternalBootLoader.run(Ljava/lang/String;Ljava/net/URL;Ljava/lang/String;[Ljava/lang/String;)Ljava/lang/Object; org/eclipse/core/boot/BootLoader.run(Ljava/lang/String;Ljava/net/URL;Ljava/lang/String;[Ljava/lang/String;)Ljava/lang/Object; EclipseRuntimeLauncher.main([Ljava/lang/String;)V 4 org.eclipse.jdt.core 969 B does not exist.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
}
	
	private IType resolveSuperTypeName(IJavaProject jproject, String sclassName) throws JavaModelException {
		IType type= null;
		if (isEnclosingTypeSelected()) {
			
			IType enclosingType= getEnclosingType();
			if (enclosingType != null) {
				String[][] res= enclosingType.resolveType(sclassName);
				if (res != null && res.length > 0) {
					type= JavaModelUtil.findType(jproject, res[0][0], res[0][1]);
				}
			}
		} else {
			IPackageFragment currPack= getPackageFragment();
			if (type == null && currPack != null) {
				String packName= currPack.getElementName();
				
				if (!currPack.isDefaultPackage()) {
					type= JavaModelUtil.findType(jproject, packName, sclassName);
				}
				
				if (type == null && !"java.lang".equals(packName)) { 
					type= JavaModelUtil.findType(jproject, "java.lang", sclassName); 
				}
			}
			
			if (type == null) {
				type= JavaModelUtil.findType(jproject, sclassName);
			}