Author: scabanovich
Date: 2009-10-09 12:44:24 -0400 (Fri, 09 Oct 2009)
New Revision: 18015
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/resources/meta/jsf2-components.meta
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/model/CompositeComponentNamespaces.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/model/FileCompositeComponentRecognizer.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4970
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/resources/meta/jsf2-components.meta
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/resources/meta/jsf2-components.meta 2009-10-09
15:32:00 UTC (rev 18014)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/resources/meta/jsf2-components.meta 2009-10-09
16:44:24 UTC (rev 18015)
@@ -71,7 +71,8 @@
default="http://www.w3.org/1999/xhtml" name="xmlns"
xmlname="xmlns"/>
<XModelAttribute name="xmlns:xsi" xmlname="xmlns:xsi"/>
<XModelAttribute name="xsi:schemaLocation"
xmlname="xsi:schemaLocation"/>
- <XModelAttribute name="namespaceMapping"/>
+ <XModelAttribute
+ default="composite composite
http://java.sun.com/jsf/composite"
name="namespaceMapping"/>
<XModelAttribute name="encoding">
<Constraint loader="ListString">
<value name="ISO-8859-1"/>
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/model/CompositeComponentNamespaces.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/model/CompositeComponentNamespaces.java 2009-10-09
15:32:00 UTC (rev 18014)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/model/CompositeComponentNamespaces.java 2009-10-09
16:44:24 UTC (rev 18015)
@@ -80,26 +80,22 @@
// StringBuffer loc = new StringBuffer();
// loc.append(object.getAttributeValue("xsi:schemaLocation")); //$NON-NLS-1$
XModelObject[] cs = object.getChildren();
+
Set<String> ns = new HashSet<String>();
+
for (int i = 0; i < cs.length; i++) {
String n = cs[i].getModelEntity().getXMLSubPath();
int k = n.indexOf(':');
if(k < 0) continue;
String defaultNamespace = n.substring(0, k);
- if(ns.contains(defaultNamespace)) continue;
- ns.add(defaultNamespace);
- String uri = namespaceMapping.getURIForDefaultNamespace(defaultNamespace);
- if(uri == null) continue;
- String actualNamespace = namespaceMapping.getActualNamespace(defaultNamespace);
- if(actualNamespace == null) actualNamespace = defaultNamespace;
- element.setAttribute(XMLNS_PREFIX + actualNamespace, uri);
+ validateNamespace(element, namespaceMapping, defaultNamespace, ns);
// String schema = getSchema(defaultNamespace);
// if(loc.indexOf(uri) < 0) {
// loc.append(' ').append(uri).append(' ').append(schema);
// }
}
-
+
XModelObject im = object.getChildByPath("Implementation");
if(im != null) {
XModelObject[] cs2 = im.getChildren();
@@ -108,15 +104,23 @@
int k = n.indexOf(':');
if(k < 0) continue;
String defaultNamespace = n.substring(0, k);
- if(ns.contains(defaultNamespace)) continue;
- ns.add(defaultNamespace);
- String uri = namespaceMapping.getURIForDefaultNamespace(defaultNamespace);
- if(uri == null) continue;
- String actualNamespace = namespaceMapping.getActualNamespace(defaultNamespace);
- if(actualNamespace == null) actualNamespace = defaultNamespace;
- element.setAttribute(XMLNS_PREFIX + actualNamespace, uri);
+ validateNamespace(element, namespaceMapping, defaultNamespace, ns);
}
}
+
+ if(!ns.contains("composite")) {
+ validateNamespace(element, namespaceMapping, "composite", ns);
+ }
// object.setAttributeValue("xsi:schemaLocation", loc.toString());
//$NON-NLS-1$
}
+
+ static void validateNamespace(Element element, NamespaceMapping namespaceMapping, String
defaultNamespace, Set<String> ns) {
+ if(ns.contains(defaultNamespace)) return;
+ ns.add(defaultNamespace);
+ String uri = namespaceMapping.getURIForDefaultNamespace(defaultNamespace);
+ if(uri == null) return;
+ String actualNamespace = namespaceMapping.getActualNamespace(defaultNamespace);
+ if(actualNamespace == null) actualNamespace = defaultNamespace;
+ element.setAttribute(XMLNS_PREFIX + actualNamespace, uri);
+ }
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/model/FileCompositeComponentRecognizer.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/model/FileCompositeComponentRecognizer.java 2009-10-09
15:32:00 UTC (rev 18014)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/model/FileCompositeComponentRecognizer.java 2009-10-09
16:44:24 UTC (rev 18015)
@@ -20,7 +20,7 @@
int j = body.indexOf(">", i); //$NON-NLS-1$
if(j < 0) return false;
String s = body.substring(i, j);
- return s.indexOf(COMPOSITE_XMLNS) > 0;
+ return s.indexOf("\"" + COMPOSITE_XMLNS + "\"") >
0; //$NON-NLS-1$ //$NON-NLS-2$
}
}