diff options
author | itrimble | 2011-10-27 22:20:14 +0000 |
---|---|---|
committer | itrimble | 2011-10-27 22:20:14 +0000 |
commit | bb7d94850bbc29c91122f7e886ab23250db3f3e6 (patch) | |
tree | dfec0c48c12e7b1e62ef813ac29553c40a50c6c5 /jsf | |
parent | 5e04c108a705642705551b813a09850ac7565b29 (diff) | |
download | webtools.jsf-bb7d94850bbc29c91122f7e886ab23250db3f3e6.tar.gz webtools.jsf-bb7d94850bbc29c91122f7e886ab23250db3f3e6.tar.xz webtools.jsf-bb7d94850bbc29c91122f7e886ab23250db3f3e6.zip |
Bug 312980 - [JSF2.0] "attrs" JSF 2.0 virtual property of a component available in pre-JSF2.0 apps
Diffstat (limited to 'jsf')
-rw-r--r-- | jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/el/DefaultDTPropertyResolver.java | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/el/DefaultDTPropertyResolver.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/el/DefaultDTPropertyResolver.java index b1196258b..672e17658 100644 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/el/DefaultDTPropertyResolver.java +++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/el/DefaultDTPropertyResolver.java @@ -19,12 +19,15 @@ import java.util.List; import org.eclipse.emf.common.util.BasicEList; import org.eclipse.emf.common.util.EList; +import org.eclipse.jdt.core.IField; +import org.eclipse.jdt.core.IType; import org.eclipse.jdt.core.Signature; import org.eclipse.jst.jsf.common.internal.types.StringLiteralType; import org.eclipse.jst.jsf.common.internal.types.TypeConstants; import org.eclipse.jst.jsf.common.internal.types.ValueType; import org.eclipse.jst.jsf.context.symbol.ERuntimeSource; import org.eclipse.jst.jsf.context.symbol.IBoundedTypeDescriptor; +import org.eclipse.jst.jsf.context.symbol.IJavaTypeDescriptor2; import org.eclipse.jst.jsf.context.symbol.IObjectSymbol; import org.eclipse.jst.jsf.context.symbol.ISymbol; import org.eclipse.jst.jsf.context.symbol.ITypeDescriptor; @@ -183,9 +186,22 @@ public class DefaultDTPropertyResolver extends AbstractDTPropertyResolver return (ISymbol[]) symbolsList.toArray(ISymbol.EMPTY_SYMBOL_ARRAY); } + private boolean isAttrsValidProperty(final ITypeDescriptor typeDesc) { + boolean valid = false; + if (typeDesc instanceof IJavaTypeDescriptor2) { + final IType type = ((IJavaTypeDescriptor2)typeDesc).getType(); + if (type != null) { + //"CURRENT_COMPOSITE_COMPONENT" will only be present from 2.0 on, where "attrs" is valid + final IField field = type.getField("CURRENT_COMPOSITE_COMPONENT"); //$NON-NLS-1$ + valid = (field != null && field.exists()); + } + } + return valid; + } + private ISymbol getCCAttrsSymbolIfNecessary(final ITypeDescriptor typeDesc) { ISymbol attrsSymbol = null; - if (typeDesc.instanceOf(UICOMPONENT_SYMBOL_SIGNATURE)) { + if (typeDesc.instanceOf(UICOMPONENT_SYMBOL_SIGNATURE) && isAttrsValidProperty(typeDesc)) { attrsSymbol = _symbolFactory.createUnknownInstanceSymbol(ATTRS_SYMBOL_NAME, ERuntimeSource.BUILT_IN_SYMBOL_LITERAL); } return attrsSymbol; |