Author: akazakov
Date: 2009-06-25 17:51:46 -0400 (Thu, 25 Jun 2009)
New Revision: 16211
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractTagLib.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/CustomTagLibAttribute.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2808
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageProcessor.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageProcessor.java 2009-06-25
21:23:26 UTC (rev 16210)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageProcessor.java 2009-06-25
21:51:46 UTC (rev 16211)
@@ -67,6 +67,10 @@
attrbMap.put(att.getName(), att);
}
}
+ IAttribute[] attrs = getAttributes(query, context, false);
+ for (int i = 0; i < attrs.length; i++) {
+ attrbMap.put(attrs[i].getName(), attrs[i]);
+ }
for (int i = 0; i < componentExtensions.length; i++) {
if(attrbMap.containsKey(componentExtensions[i].getName())) {
TextProposal[] attProposals = componentExtensions[i].getProposals(query, context);
@@ -84,7 +88,6 @@
}
} else {
String value = query.getValue();
- //TODO convert value to EL string.
String elString = value;
ELResolver[] resolvers = context.getElResolvers();
for (int i = 0; resolvers != null && i < resolvers.length; i++) {
@@ -121,16 +124,16 @@
for (int i = 0; i < libs.length; i++) {
IComponent[] libComponents = libs[i].getComponents(query, context);
for (int j = 0; j < libComponents.length; j++) {
- if(includeComponentExtensions || !libComponents[i].isExtended()) {
- components.add(libComponents[i]);
+ if(includeComponentExtensions || !libComponents[j].isExtended()) {
+ components.add(libComponents[j]);
}
}
}
for (int i = 0; customTagLibs != null && i < customTagLibs.length; i++) {
IComponent[] libComponents = customTagLibs[i].getComponents(query, context);
for (int j = 0; j < libComponents.length; j++) {
- if(includeComponentExtensions || !libComponents[i].isExtended()) {
- components.add(libComponents[i]);
+ if(includeComponentExtensions || !libComponents[j].isExtended()) {
+ components.add(libComponents[j]);
}
}
}
@@ -146,20 +149,26 @@
* @return attributes
*/
public IAttribute[] getAttributes(KbQuery query, IPageContext context) {
+ return getAttributes(query, context, true);
+ }
+
+ private IAttribute[] getAttributes(KbQuery query, IPageContext context, boolean
includeComponentExtensions) {
if(query.getType() == KbQuery.Type.ATTRIBUTE_NAME || query.getType() ==
KbQuery.Type.ATTRIBUTE_VALUE) {
ArrayList<IAttribute> attributes = new ArrayList<IAttribute>();
Map<String, IAttribute> attrbMap = new HashMap<String, IAttribute>();
- IComponent[] components = getComponents(query, context, true);
+ IComponent[] components = getComponents(query, context, includeComponentExtensions);
for (int i = 0; i < components.length; i++) {
IAttribute[] libAttributess = components[i].getAttributes(query, context);
for (int j = 0; j < libAttributess.length; j++) {
- attributes.add(libAttributess[i]);
- attrbMap.put(libAttributess[i].getName(), libAttributess[i]);
+ attributes.add(libAttributess[j]);
+ attrbMap.put(libAttributess[j].getName(), libAttributess[j]);
}
}
- for (int i = 0; i < componentExtensions.length; i++) {
- if(attrbMap.containsKey(componentExtensions[i].getName())) {
- attributes.add(componentExtensions[i]);
+ if(includeComponentExtensions) {
+ for (int i = 0; i < componentExtensions.length; i++) {
+ if(attrbMap.containsKey(componentExtensions[i].getName())) {
+ attributes.add(componentExtensions[i]);
+ }
}
}
return attributes.toArray(new IAttribute[attributes.size()]);
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractTagLib.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractTagLib.java 2009-06-25
21:23:26 UTC (rev 16210)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractTagLib.java 2009-06-25
21:51:46 UTC (rev 16211)
@@ -338,8 +338,6 @@
}
} else {
for (int i = 0; i < components.length; i++) {
- if (components[i] == null)
- continue;
TextProposal[] componentProposals = components[i].getProposals(query, context);
for (int j = 0; j < componentProposals.length; j++) {
proposals.add(componentProposals[j]);
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/CustomTagLibAttribute.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/CustomTagLibAttribute.java 2009-06-25
21:23:26 UTC (rev 16210)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/CustomTagLibAttribute.java 2009-06-25
21:51:46 UTC (rev 16211)
@@ -69,9 +69,15 @@
@Override
public TextProposal[] getProposals(KbQuery query, IPageContext context) {
CustomProposalType[] types = getProposals();
+ if(types.length==1) {
+ return types[0].getProposals(query, context);
+ }
List<TextProposal> proposals = new ArrayList<TextProposal>();
for (int i = 0; i < types.length; i++) {
- // TODO
+ TextProposal[] typeProposals = types[i].getProposals(query, context);
+ for (int j = 0; j < typeProposals.length; j++) {
+ proposals.add(typeProposals[j]);
+ }
}
return proposals.toArray(new TextProposal[0]);
}