Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Schindl2014-10-21 08:30:26 +0000
committerTom Schindl2014-10-21 08:30:26 +0000
commit8fa58c7d10e58048afe3f0cbd4fa80103f4f6322 (patch)
tree9af59a3f92b8513c11b3a6690a1eb2f1cb4ed798
parent37f91b62f61b1eeeb279f436819b4197c4fb7f97 (diff)
downloadorg.eclipse.efxclipse-8fa58c7d10e58048afe3f0cbd4fa80103f4f6322.tar.gz
org.eclipse.efxclipse-8fa58c7d10e58048afe3f0cbd4fa80103f4f6322.tar.xz
org.eclipse.efxclipse-8fa58c7d10e58048afe3f0cbd4fa80103f4f6322.zip
Bug 448023 - FXML compiler does not support http://javafx.com/fxml/1
namespace
-rw-r--r--bundles/tooling/org.eclipse.fx.ide.fxml.compiler/src/org/eclipse/fx/ide/fxml/compiler/FXMLSaxHandler.xtend29
1 files changed, 22 insertions, 7 deletions
diff --git a/bundles/tooling/org.eclipse.fx.ide.fxml.compiler/src/org/eclipse/fx/ide/fxml/compiler/FXMLSaxHandler.xtend b/bundles/tooling/org.eclipse.fx.ide.fxml.compiler/src/org/eclipse/fx/ide/fxml/compiler/FXMLSaxHandler.xtend
index ff6939e1b..5bbf7728a 100644
--- a/bundles/tooling/org.eclipse.fx.ide.fxml.compiler/src/org/eclipse/fx/ide/fxml/compiler/FXMLSaxHandler.xtend
+++ b/bundles/tooling/org.eclipse.fx.ide.fxml.compiler/src/org/eclipse/fx/ide/fxml/compiler/FXMLSaxHandler.xtend
@@ -34,6 +34,7 @@ class FXMLSaxHandler extends DefaultHandler {
private boolean valueOfType = false;
private static String FXML_NAMESPACE = "http://javafx.com/fxml"
+ private static String FXML_NAMESPACE_1 = "http://javafx.com/fxml/1"
@Inject
new(IJvmTypeProvider.Factory jdtTypeProviderFactory)
@@ -73,10 +74,24 @@ class FXMLSaxHandler extends DefaultHandler {
globalImports.add(i.importedNamespace.substring(0,i.importedNamespace.lastIndexOf('.')))
}
}
- }
+ }
+
+ def String getFXAttributeValue(Attributes attributes, String name) {
+ var v = attributes.getValue(FXML_NAMESPACE,name);
+
+ if( v == null ) {
+ v = attributes.getValue(FXML_NAMESPACE_1,name);
+ }
+
+ return v;
+ }
+
+ def boolean isFXNamedSpace(String uri) {
+ return uri == FXML_NAMESPACE || uri == FXML_NAMESPACE_1;
+ }
override startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
- if( uri != FXML_NAMESPACE && localName.contains('.') ) {
+ if( ! uri.isFXNamedSpace && localName.contains('.') ) {
// A static property
val e = stack.peek as Element
val prop = FXGraphFactory.eINSTANCE.createStaticCallValueProperty
@@ -89,7 +104,7 @@ class FXMLSaxHandler extends DefaultHandler {
e.staticCallProperties.add(prop);
stack.push(prop)
- } else if( uri != FXML_NAMESPACE && Character.isLowerCase(localName.charAt(0)) ) {
+ } else if( ! uri.isFXNamedSpace && Character.isLowerCase(localName.charAt(0)) ) {
// A property
val e = stack.peek as Element
val prop = FXGraphFactory.eINSTANCE.createProperty
@@ -106,11 +121,11 @@ class FXMLSaxHandler extends DefaultHandler {
stack.push(prop)
} else {
- if( attributes.getValue(FXML_NAMESPACE,"value") != null ) {
+ if( attributes.getFXAttributeValue("value") != null ) {
val p = stack.peek as Property;
val lp = p.value as ListValueProperty
val vp = FXGraphFactory.eINSTANCE.createSimpleValueProperty
- vp.setStringValue(attributes.getValue(FXML_NAMESPACE,"value"));
+ vp.setStringValue(attributes.getFXAttributeValue("value"));
lp.value += vp;
valueOfType = true;
return;
@@ -119,7 +134,7 @@ class FXMLSaxHandler extends DefaultHandler {
// An element
val e = FXGraphFactory.eINSTANCE.createElement
- val isDynRoot = localName == 'root' && uri == FXML_NAMESPACE
+ val isDynRoot = localName == 'root' && uri.isFXNamedSpace
val t = TypesFactory.eINSTANCE.createJvmParameterizedTypeReference();
if( isDynRoot ) {
model.componentDef.dynamicRoot = true;
@@ -131,7 +146,7 @@ class FXMLSaxHandler extends DefaultHandler {
var i = 0;
while( i < attributes.length ) {
- if( FXML_NAMESPACE.equals(attributes.getURI(i)) ) {
+ if( attributes.getURI(i).isFXNamedSpace ) {
if( "id".equals(attributes.getLocalName(i)) ) {
e.name = attributes.getValue(i)
idMap.put(e.name,e);

Back to the top