Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 350972 - Unable to install Web Fragment Module facet into existing project.
Summary: Unable to install Web Fragment Module facet into existing project.
Status: RESOLVED FIXED
Alias: None
Product: WTP Java EE Tools
Classification: WebTools
Component: jst.j2ee (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal with 1 vote (vote)
Target Milestone: 3.6.3   Edit
Assignee: Roberto Sanchez Herrera CLA
QA Contact: Chuck Bridgham CLA
URL:
Whiteboard:
Keywords:
: 430843 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-07-01 17:52 EDT by Alexey Kazakov CLA
Modified: 2015-06-24 12:44 EDT (History)
4 users (show)

See Also:
cbridgha: review+


Attachments
Screenshot of Project Facets properties page. (178.32 KB, image/png)
2011-07-01 17:54 EDT, Alexey Kazakov CLA
no flags Details
Proposed fix (5.44 KB, patch)
2015-01-13 12:55 EST, Roberto Sanchez Herrera CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Kazakov CLA 2011-07-01 17:52:44 EDT
Build Identifier: I20110613-1736

It seems that the only way to install Web Fragment facet is using New Faceted Project Wizard. If I already have a project, I can't find a way to install this facet.

Reproducible: Always

Steps to Reproduce:
1. Create a Java (1.6) project.
2. Convert it to a faceted project.
3. Open Project Propeties->Project Facets
4. Click on Java Facet (1.6) to install it. Apply button is enabled.
5. Click on Web Fragment Module Facet to install it. Apply button is disabled.
Comment 1 Alexey Kazakov CLA 2011-07-01 17:54:42 EDT
Created attachment 198986 [details]
Screenshot of Project Facets properties page.
Comment 2 Roberto Sanchez Herrera CLA 2014-12-26 14:49:56 EST
The problem is in WebFragmentFacetInstallDataModelProvider: this class does not provide a default value for the CONFIG_FOLDER property, and the parent class (J2EEModuleFacetInstallDataModelProvider) validates that the CONFIG_FOLDER property is not null nor empty. 

So, when the data model is validated by the facets property page, the validation returns an error, and therefore the OK button is never enabled.

The fix could be either override the validate method in WebFragmentFacetInstallDataModelProvider to always return an OK status for CONFIG_FOLDER, or provide a valid default value for CONFIG in WebFragmentFacetInstallDataModelProvider (could use something similar to the code in UtilityFacetInstallDataModelProvider, to get the first source folder defined by the java facet).
Comment 3 Roberto Sanchez Herrera CLA 2015-01-13 12:55:36 EST
Created attachment 249908 [details]
Proposed fix

I0m following the approach of setting the default value to the first src folder found, like in the case of utility facet.

I tested creating new web fragment projects using the wizard, and using the facets property page to add the web fragment facet, and works fine.
Comment 4 Chuck Bridgham CLA 2015-01-14 07:24:19 EST
Fix looks good - I assume everything is ok is multiple src folders are defined?  we don't actually generate any src in this action, so its just to satisfy the validation.
Comment 5 Roberto Sanchez Herrera CLA 2015-01-14 12:29:57 EST
Yes, multiple src folders behave correctly. 

Committed to master for WTP 3.6.3 and 3.7

http://git.eclipse.org/c/jeetools/webtools.javaee.git/commit/?id=68c0e1b5cfcf191245ca8ef5dcbf91b6648beb8d

I did not update the version of the feature because it was increased by another bug.
Comment 6 Roberto Sanchez Herrera CLA 2015-06-24 12:44:38 EDT
*** Bug 430843 has been marked as a duplicate of this bug. ***