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

Bug 317746

Summary: Content Model for Facelets is not contributed properly
Product: [WebTools] Java Server Faces Reporter: Yury Kats <yurykats>
Component: CoreAssignee: Ian Trimble <ian.trimble>
Status: RESOLVED FIXED QA Contact: Cameron Bateman <cameron.bateman>
Severity: normal    
Priority: P3 CC: nsand.dev, raghunathan.srinivasan, robert_gallagher, thatnitind
Version: 3.2   
Target Milestone: 3.3 M7   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Yury Kats CLA 2010-06-23 16:05:56 EDT
Content Model (CM) for Facelets is contributed in such a way that it's only being used for content assist (CA). Any general queries for CM for a given Node in a Facelets document comes back empty. Our adopter product has a number of places where a list of Wlement's attributes is requested via CM, using the following SSE APIs:

ModelQuery modelQuery = ModelQueryUtil.getModelQuery(node.getOwnerDocument());
CMElementDeclaration elementDeclaration = modelQuery.getCMElementDeclaration((Element) node);

In case of facelets, elementDeclaration comes back as null.

This appears to be due to the fact that CM information is not contributed to SSE by means of a Model Query (ext-point org.eclipse.wst.xml.core.modelQueryExtensions). 

I see this ext point present in plugin.xml for o.e.jst.jsf.facelets.ui, but commented out.
Comment 1 Cameron Bateman CLA 2010-08-23 15:37:56 EDT
Our experience with model query in the past is that it is too limited to be useful for our purposes. What feature is missing or disabled because of the lack of content model objects?
Comment 2 Nitin Dahyabhai CLA 2010-08-24 12:45:43 EDT
What limits were you alluding to?
Comment 3 Cameron Bateman CLA 2010-08-24 13:22:53 EDT
I would need to go back through our attempts to do Facelet support, but as I recall, it was only really useful for narrow content assist use cases.  Two open bugs that illustrate some of the limitations are:

153563 and 311957.
Comment 4 Yury Kats CLA 2010-08-30 14:25:13 EDT
(In reply to comment #1)
> What feature is missing or disabled because of the lack of content model objects?

Our adopter product uses generic Content Model API in many places, usually (but not limited) to get a list of attributes of a given node.

Therefore all CM-based features of the product work fine on a JSP, but fail on a Facelet page, due to lack of the Content Model. 

The typical generic code to get attributes of a node looks like this:

ModelQuery modelQuery = ModelQueryUtil.getModelQuery(node.getOwnerDocument());
CMElementDeclaration elementDeclaration = modelQuery.getCMElementDeclaration((Element) node);
CMNamedNodeMap nodeMap = elementDeclaration.getAttributes();
Comment 5 Raghunathan Srinivasan CLA 2010-09-07 14:06:20 EDT
Deferring this to 3.3 due to lack of resources.
Comment 6 Ian Trimble CLA 2011-03-31 20:13:30 EDT
Fix submitted at 2011/03/31 05:12PM PDT.