Bug 95326 [code manipulation] Class wizard produces junk
Env: 3.1M7 Sometimes the class wizard produces junk when generating a new class skeleton (seems that constructors are placed inside the import statements). With the following example, the bug can always reproduced: 0) no enclosing type 1) Create a new Class: JxX509TrustManager 2) Modifiers: public only 3) SuperClass: java.lang.Object 4) Interfaces: javax.net.ssl.X509TrustManager 5) Stubs: constructor, abstract methods 6) Generate comments: no 7) Finish produces: <pre> package bla.bla; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; import j public JxX509TrustManager() { super(); // @todo Auto-generated constructor stub }avax.net.ssl.X509TrustManager; public class JxX509TrustManager implements X509TrustManager { public void checkClientTrusted(X509Certificate[] arg0, String arg1) throws CertificateException { // @todo Auto-generated method stub } public void checkServerTrusted(X509Certificate[] arg0, String arg1) throws CertificateException { // @todo Auto-generated method stub } public X509Certificate[] getAcceptedIssuers() { // @todo Auto-generated method stub return null; } } </pre>
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
getWizard().getContainer(), scope, IJavaSearchConstants.CLASS);
		dialog.setTitle(NewWizardMessages.NewTypeWizardPage_SuperClassDialog_title); 
		dialog.setMessage(NewWizardMessages.NewTypeWizardPage_SuperClassDialog_message); 
		dialog.setFilter(getSuperClass());
		if (dialog.open() == Window.OK) {
			return (IType) dialog.getFirstResult();
		}
		return null;
	}
	
	private void chooseSuperInterfaces() {
		IPackageFragmentRoot root= getPackageFragmentRoot();
		if (root == null) {
			return;
		}	
		IJavaProject project= root.getJavaProject();
		SuperInterfaceSelectionDialog dialog= new SuperInterfaceSelectionDialog(getShell(), getWizard().getContainer(), fSuperInterfacesDialogField, project);
		dialog.setTitle(getInterfaceDialogTitle());
		dialog.setMessage(NewWizardMessages.NewTypeWizardPage_InterfacesDialog_message); 
		dialog.open();
		List interfaces= fSuperInterfacesDialogField.getElements();
		if (interfaces.size() > 0)
			fSuperInterfacesDialogField.getTableViewer().editElement(interfaces.get(interfaces.size() - 1), 0);
		return;
	}
	
	private String getInterfaceDialogTitle() {
	    if (fTypeKind == INTERFACE_TYPE)
	        return NewWizardMessages.NewTypeWizardPage_InterfacesDialog_interface_title; 
	    return NewWizardMessages.NewTypeWizardPage_InterfacesDialog_class_title;