[jbosstools-commits] JBoss Tools SVN: r42644 - trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/include.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Wed Jul 18 20:03:08 EDT 2012


Author: scabanovich
Date: 2012-07-18 20:03:07 -0400 (Wed, 18 Jul 2012)
New Revision: 42644

Modified:
   trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/include/IncludeModel.java
Log:
JBIDE-12295
https://issues.jboss.org/browse/JBIDE-12295
Open-on of multiple declarations of ui:param with the same name are supported.

Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/include/IncludeModel.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/include/IncludeModel.java	2012-07-18 23:36:46 UTC (rev 42643)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/include/IncludeModel.java	2012-07-19 00:03:07 UTC (rev 42644)
@@ -87,7 +87,12 @@
 	static final String STORE_ATTR_PATH = "path"; //$NON-NLS-1$
 	static final String STORE_ATTR_NAME = "name"; //$NON-NLS-1$
 	static final String STORE_ATTR_VALUE = "value"; //$NON-NLS-1$
+	static final String STORE_ATTR_OFFSET = "off"; //$NON-NLS-1$
+	static final String STORE_ATTR_LENGTH = "len"; //$NON-NLS-1$
 
+	static final String STORE_ELEMENT_ALIASES = "aliases"; //$NON-NLS-1$
+	static final String STORE_ELEMENT_ALIAS = "alias"; //$NON-NLS-1$
+
 	/*
 	 * (non-Javadoc)
 	 * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#store(org.w3c.dom.Element)
@@ -112,19 +117,19 @@
 					Element varElement = XMLUtilities.createElement(includeElement, STORE_ELEMENT_VAR);
 					varElement.setAttribute(STORE_ATTR_NAME, var.getName());
 					varElement.setAttribute(STORE_ATTR_VALUE, var.getValue());
-					varElement.setAttribute("off", "" + var.getDeclarationOffset());
-					varElement.setAttribute("len", "" + var.getDeclarationLength());
+					varElement.setAttribute(STORE_ATTR_OFFSET, "" + var.getDeclarationOffset());
+					varElement.setAttribute(STORE_ATTR_LENGTH, "" + var.getDeclarationLength());
 				}
 			}
 		}
 		
-		Element aliases = XMLUtilities.getUniqueChild(root, "aliases"); //$NON-NLS-1$
+		Element aliases = XMLUtilities.getUniqueChild(root, STORE_ELEMENT_ALIASES);
 		if(aliases == null) {
-			aliases = XMLUtilities.createElement(root, "aliases"); //$NON-NLS-1$
+			aliases = XMLUtilities.createElement(root, STORE_ELEMENT_ALIASES);
 		}
 		for (String path: pathAliases.keySet()) {
 			String value = pathAliases.get(path);
-			Element alias = XMLUtilities.createElement(aliases, "alias"); //$NON-NLS-1$
+			Element alias = XMLUtilities.createElement(aliases, STORE_ELEMENT_ALIAS);
 			alias.setAttribute(STORE_ATTR_PATH, path);
 			alias.setAttribute(STORE_ATTR_VALUE, value);
 		}
@@ -157,16 +162,16 @@
 					String value = v.getAttribute(STORE_ATTR_VALUE);
 					int offset = 0;
 					int length = 0;
-					if(v.hasAttribute("off")) {
+					if(v.hasAttribute(STORE_ATTR_OFFSET)) {
 						try {
-							offset = Integer.parseInt(v.getAttribute("off"));
+							offset = Integer.parseInt(v.getAttribute(STORE_ATTR_OFFSET));
 						} catch (NumberFormatException e) {
 							WebKbPlugin.getDefault().logError(e);
 						}
 					}
-					if(v.hasAttribute("len")) {
+					if(v.hasAttribute(STORE_ATTR_LENGTH)) {
 						try {
-							length = Integer.parseInt(v.getAttribute("len"));
+							length = Integer.parseInt(v.getAttribute(STORE_ATTR_LENGTH));
 						} catch (NumberFormatException e) {
 							WebKbPlugin.getDefault().logError(e);
 						}
@@ -185,9 +190,9 @@
 
 	Map<String, String> loadAliases(Element root) {
 		Map<String, String> pathAliases = new HashMap<String, String>();
-		Element aliases = XMLUtilities.getUniqueChild(root, "aliases"); //$NON-NLS-1$
+		Element aliases = XMLUtilities.getUniqueChild(root, STORE_ELEMENT_ALIASES);
 		if(aliases != null) {
-			Element[] aliasArray = XMLUtilities.getChildren(aliases, "alias"); //$NON-NLS-1$
+			Element[] aliasArray = XMLUtilities.getChildren(aliases, STORE_ELEMENT_ALIAS);
 			for (Element alias: aliasArray) {
 				String path = alias.getAttribute(STORE_ATTR_PATH);
 				String value = alias.getAttribute(STORE_ATTR_VALUE);



More information about the jbosstools-commits mailing list