Bug 13034 Cannot create a Source Folder in a new Java Project
build 20020404 If you try and create a Source Folder in a Java Project you have just created you get an error preventing you from hitting finish. STEPS 1) Create Java Project Foo 2) Open New->Source Folder 3) Enter Bar as the name - you will get "Cannot nest entry Bar inside entry Foo/Bar" 4) Create a folder Bar. 5) Add it as a source folder in the Properties Dialog for Foo. No problem.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewSourceFolderWizardPage.java
IClasspathEntry[] entries= fCurrJProject.getRawClasspath();
		IClasspathEntry[] newEntries= new IClasspathEntry[entries.length + 1];
		for (int i= entries.length - 1, k= entries.length; i >= 0; i--) {
			IClasspathEntry curr= entries[i];
			if (k > i && curr.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
				newEntries[k--]= JavaCore.newSourceEntry(path);
			}
			newEntries[k--]= curr;
		}
		fCurrJProject.setRawClasspath(newEntries, monitor);
		
		return fCurrJProject.getPackageFragmentRoot(folder);
	}
	
	
	
	private IFolder chooseFolder() {	
		Class[] acceptedClasses= new Class[] { IFolder.class };
		ISelectionStatusValidator validator= new TypedElementSelectionValidator(acceptedClasses, false);
		Object[] notWanted= getFilteredExistingContainerEntries();
		ViewerFilter filter= new TypedViewerFilter(acceptedClasses, notWanted);	
		
		ILabelProvider lp= new WorkbenchLabelProvider();
		ITreeContentProvider cp= new WorkbenchContentProvider();
		ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(getShell(), lp, cp);
		dialog.setValidator(validator);
		dialog.setTitle(NewWizardMessages.getString("NewSourceFolderWizardPage.ChooseExistingRootDialog.title")); 
		dialog.setMessage(NewWizardMessages.getString("NewSourceFolderWizardPage.ChooseExistingRootDialog.description")); 
		dialog.addFilter(filter);
		dialog.setInput(fCurrJProject.getProject());