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

Bug 332806

Summary: FacetedProjectWizard class bug
Product: [WebTools] WTP Common Tools Reporter: Lee Wang-soo <hivemind02>
Component: Faceted Project FrameworkAssignee: Konstantin Komissarchik <konstantin>
Status: RESOLVED FIXED QA Contact: Konstantin Komissarchik <konstantin>
Severity: normal    
Priority: P3 CC: ccc
Version: 3.2.2   
Target Milestone: 3.2.3   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
patch for fixing 33286 bug
konstantin: iplog+
simple plugin project for test patch none

Description Lee Wang-soo CLA 2010-12-16 20:17:32 EST
Build Identifier: M20100909-0800

I've created new wizard by extending
org.eclipse.wst.common.project.facet.ui.FacetedProjectWizard.
When my new wizard does finish, error 'Invalid project description' occurred and project creations fails.
I look the code in FactedProjectWizard, and found the code cause error:
 @Override
    public IWizardPage getNextPage( final IWizardPage page )    {
        if( page == this.firstPage )        {
            final IFacetedProjectWorkingCopy fpjwc = getFacetedProjectWorkingCopy();
            fpjwc.setProjectName( this.firstPage.getProjectName() );
            fpjwc.setProjectLocation( this.firstPage.getLocationPath() );
        }
        return super.getNextPage( page );
    }

last line: 

  fpjwc.setProjectLocation( this.firstPage.getLocationPath() ); 

should be modified to

  IPath locationPath = null;
  if (firstPage.useDefaults()) {
    locationPath = this.firstPage.getLocationPath();
  }
  fpjwc.setProjectLocation(locationPath);

When using default project location (workspace location), locationPath should be null.


Reproducible: Always
Comment 1 Lee Wang-soo CLA 2010-12-16 20:49:59 EST
(In reply to comment #0)

There is mistake. Above modified code should be as following:

  IPath locationPath = null;
  if (!firstPage.useDefaults()) { // when not using default location
    locationPath = this.firstPage.getLocationPath();
  }
  fpjwc.setProjectLocation(locationPath);

When using default project location (workspace location), locationPath should
be null.
Comment 2 Carl Anderson CLA 2010-12-17 11:38:26 EST
Lee, are you able to create a patch for this? Attaching a proposed patch helps more than simply putting the code change into a bug comment.
Comment 3 Lee Wang-soo CLA 2010-12-17 19:47:53 EST
Created attachment 185469 [details]
patch for fixing 33286 bug
Comment 4 Lee Wang-soo CLA 2010-12-17 19:51:22 EST
Created attachment 185470 [details]
simple plugin project for test patch

You can test patch by run "Extends FPWizard" New Project Wizard in others category.
Comment 5 Konstantin Komissarchik CLA 2011-01-05 15:02:30 EST
Comment on attachment 185469 [details]
patch for fixing 33286 bug

Thanks for the patch and the test plugin.
Comment 6 Konstantin Komissarchik CLA 2011-01-05 15:03:13 EST
Released fix to 3.2.3, 3.3.0 and fproj branch.