Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 143027

Summary: New Project Wizard behaves strangly when hierarchy does not contain any java file or only invalid ones
Product: [Eclipse Project] JDT Reporter: Frederic Fusier <frederic_fusier>
Component: UIAssignee: Benno Baumgartner <benno.baumgartner>
Status: CLOSED INVALID QA Contact:
Severity: minor    
Priority: P3 CC: martinae
Version: 3.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Frederic Fusier CLA 2006-05-22 13:50:41 EDT
Using 3.2 RC5

I was trying to redo screenshots of "Project configuration tutorial" in Getting started help section. I was working on second scenario: "Organizing sources" and got troubles with third snapshot. After having clicked on Next button on first wizard page, I didn't get expected result in following page:
  MyProject
    * sources
    + tests
but
  MyProject
    * src
    + sources
    + tests
instead...
('*' means a source folder icon, '+' a normal folder icon...)

It seems that changes done in Build Path preferences page for "Source and output folders" are not taken into account...

Note that first scenario was working well as I used "src" for source folder. Any other value for it seemed to be completely ignored.
Comment 1 Martin Aeschlimann CLA 2006-05-22 17:54:40 EDT
Benno, can you investigate?
Comment 2 Frederic Fusier CLA 2006-05-23 03:11:09 EDT
This is not a regression, as it does not seem to work since 3.0...
"Orginizing scenario" does not create project from existing source, this explain why I was able to do it with previous version...

However, I think it could be interesting to make it working. If user sets a specific name for his source folders and creates a project on existing code, if this specific folder name exists in project directory, then it should definitely be used as a source folder...
Comment 3 Benno Baumgartner CLA 2006-05-23 09:23:25 EDT
Mmmmm,
1. Creating new project (not from existing source) works as expected in RC5
2. Creating new project (from existing source) works as expected in RC5 and 3.1.2

Frederic, can you please provide exact steps how you came up with only a source folder 'src' and two normal folder 'sources' and 'tests'? If I understand you correct then you've created a new project from existing source with seperate source and output folders and the default source folder set to 'sources'? I get the expected result: two source folders 'sources' and 'tests' and an output folder 'bin'.
Comment 4 Frederic Fusier CLA 2006-05-23 10:40:34 EDT
I've made a fresh install of 3.2RC5 and started it on a new workspace and *strictly* followed scenario "Organizing sources":
1. Click  Window > Open Perspective > Other... > Java to change to the Java perspective. 
2. Click  File > New > Other... > Java Project to open the New Java Project wizard. 
3. Type "MyProject" in the Project name field.
4. In Project layout group, change selection to "Create separate source and output folders" and edit Configure default... to modify Source folder name from "src" to "sources".
5. Click OK to return on New Java Project wizard and then click Next.

With these steps, I get following tree in second page of New Project Wizard:
MyProject
  * sources/com/xyz
  * tests/com/xyz
  + sources
  + tests

Note that result is quite different from comment 0 because in my hierarchy I have created empty java files although I didn't have any java files in project hierarchy in comment 0 test case...

Wizard works properly as soon as my java files contains correct class declaration => modify summary and downsize severity as this is not a common use case...
Comment 5 Benno Baumgartner CLA 2006-05-23 11:58:00 EDT
Sorry, I don't understand. Are this the steps to reproduce:
1. Create following structure outside of your workspace
MyProject
   sources
      com
        xyz
          Main.java (an empty file)
   tests
      com
        xyz
          Test.java (an empty file)
2. File > New > Java Project
3. MyProject as name
4. Select 'Create from existing source'
5. Browse and select 'MyProject' folder
Is:
  You can't set the default source folder. Source folders are detected in existing source. It's a feature not a bug.
6. Click Next
Is:
  * sources/com/xyz
  * tests/com/xyz
  + sources
  + tests
This is IMHO not a bug either. The two empty java files are put in default packages in source folders sources/com/xyz and tests/com/xyz. Which seams to be the only reasonable thing to do (except maybe ignore empty java files).

I guess what you expect is that 'sources' is add as source folder because it is the name of the default source folder and it is also part of the structure. I think this would be way more confusing to the user then the current behaviour. Disabling the 'Project Layout' section on the new wizard page when selecting 'Create from existing source' is a clear indication that there is no connection to the setting for source and output folders.

Closing as invalid.
Comment 6 Frederic Fusier CLA 2006-05-23 12:06:07 EDT
I think you understand well my configuration.

I agree that this sounds more than a user error than a bug => closing