[jbosstools-commits] JBoss Tools SVN: r23338 - in trunk: jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template and 2 other directories.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Fri Jul 9 04:59:21 EDT 2010
Author: dvinnichek
Date: 2010-07-09 04:59:21 -0400 (Fri, 09 Jul 2010)
New Revision: 23338
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ElVarSearcher.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfOutputFormatTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.seam/src/org/jboss/tools/jsf/vpe/seam/template/SeamPdfTableTemplate.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VisualDomUtil.java
Log:
some fixes according to https://jira.jboss.org/browse/JBIDE-6542
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ElVarSearcher.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ElVarSearcher.java 2010-07-09 04:40:05 UTC (rev 23337)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ElVarSearcher.java 2010-07-09 08:59:21 UTC (rev 23338)
@@ -261,9 +261,9 @@
*/
public static Var findVar(Node node, ELParserFactory factory) {
if(node!=null && Node.ELEMENT_NODE == node.getNodeType()) {
- Element element = (Element)node;
- String var = element.getAttribute(VAR_ATTRIBUTE_NAME);
- if(var!=null) {
+ Element element = (Element)node;
+ if(element.hasAttribute(VAR_ATTRIBUTE_NAME)) {
+ String var = element.getAttribute(VAR_ATTRIBUTE_NAME);
int declOffset = 0;
int declLength = 0;
Node varAttr = element.getAttributeNode(VAR_ATTRIBUTE_NAME);
@@ -274,9 +274,9 @@
declLength = varNameEnd - varNameStart;
}
var = var.trim();
- if(!"".equals(var)) { //$NON-NLS-1$
- String value = element.getAttribute(VALUE_ATTRIBUTE_NAME);
- if(value!=null) {
+ if(!"".equals(var)) { //$NON-NLS-1$
+ if(element.hasAttribute(VALUE_ATTRIBUTE_NAME)) {
+ String value = element.getAttribute(VALUE_ATTRIBUTE_NAME);
value = value.trim();
Var newVar = new Var(factory, var, value, declOffset, declLength);
if(newVar.getElToken()!=null) {
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfOutputFormatTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfOutputFormatTemplate.java 2010-07-09 04:40:05 UTC (rev 23337)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfOutputFormatTemplate.java 2010-07-09 08:59:21 UTC (rev 23338)
@@ -188,7 +188,9 @@
if (num < paramList.size() && paramList.get(num).hasAttribute(JSF.ATTR_VALUE)) {
// get param's value
- value = paramList.get(num).getAttribute(JSF.ATTR_VALUE);
+ Element paramElement = paramList.get(num);
+ value = paramElement.hasAttribute(JSF.ATTR_VALUE) ?
+ paramElement.getAttribute(JSF.ATTR_VALUE) : null;
}
} catch (NumberFormatException e) {
// illegal param value
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.seam/src/org/jboss/tools/jsf/vpe/seam/template/SeamPdfTableTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.seam/src/org/jboss/tools/jsf/vpe/seam/template/SeamPdfTableTemplate.java 2010-07-09 04:40:05 UTC (rev 23337)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.seam/src/org/jboss/tools/jsf/vpe/seam/template/SeamPdfTableTemplate.java 2010-07-09 08:59:21 UTC (rev 23338)
@@ -149,10 +149,10 @@
}
private String getWidthPerc(Element sourceElement) {
- String width = sourceElement
- .getAttribute(SeamUtil.SEAM_ATTR_WIDTH_PERCENTAGE);
- if (width != null) {
+ String width = "100%"; //$NON-NLS-1$
+ if (sourceElement.hasAttribute(SeamUtil.SEAM_ATTR_WIDTH_PERCENTAGE)) {
try {
+ width = sourceElement.getAttribute(SeamUtil.SEAM_ATTR_WIDTH_PERCENTAGE);
int intWidth = Integer.parseInt(width);
if (intWidth < 1 || intWidth > 100) {
width = "100%"; //$NON-NLS-1$
@@ -162,16 +162,14 @@
} catch (NumberFormatException e) {
width = "100%"; //$NON-NLS-1$
}
- } else {
- width = "100%"; //$NON-NLS-1$
}
return width;
}
- private String getAlignment(Element sourceElement) {
- String align = sourceElement
+ private String getAlignment(Element sourceElement) {
+ if (sourceElement.hasAttribute(SeamUtil.SEAM_ATTR_HORIZONAL_ALIGNMENT)) {
+ String align = sourceElement
.getAttribute(SeamUtil.SEAM_ATTR_HORIZONAL_ALIGNMENT);
- if (align != null) {
for (int i = 0; i < SeamUtil.POSSIBLE_ALIGNS.length; i++) {
if (SeamUtil.POSSIBLE_ALIGNS[i].equalsIgnoreCase(align)) {
if (SeamUtil.POSSIBLE_ALIGNS[i]
@@ -187,10 +185,10 @@
private int getColspanValue(nsIDOMNode visualNode) {
int colspan = 1;
- nsIDOMElement visualElement = queryInterface(visualNode, nsIDOMElement.class);
- String colspanString = visualElement.getAttribute(HTML.ATTR_COLSPAN);
- if (colspanString != null) {
+ nsIDOMElement visualElement = queryInterface(visualNode, nsIDOMElement.class);
+ if (visualElement.hasAttribute(HTML.ATTR_COLSPAN)) {
try {
+ String colspanString = visualElement.getAttribute(HTML.ATTR_COLSPAN);
colspan = Integer.parseInt(colspanString);
if (colspan < 1) {
colspan = 1;
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VisualDomUtil.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VisualDomUtil.java 2010-07-09 04:40:05 UTC (rev 23337)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VisualDomUtil.java 2010-07-09 08:59:21 UTC (rev 23338)
@@ -229,10 +229,10 @@
return;
for (String attributeName : attributes) {
-
- String attributeValue = sourceElement.getAttribute(attributeName);
- if (attributeValue != null)
+ if (sourceElement.hasAttribute(attributeName)) {
+ String attributeValue = sourceElement.getAttribute(attributeName);
visualElement.setAttribute(attributeName, attributeValue);
+ }
}
}
More information about the jbosstools-commits
mailing list