Author: akazakov
Date: 2010-09-30 11:16:14 -0400 (Thu, 30 Sep 2010)
New Revision: 25339
Added:
trunk/jsf/tests/org.jboss.tools.jsf.test/projects/TestKbModel/WebContent/pages/actionparam.xhtml
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/kb/test/FaceletsKbModelTest.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/XmlTagCompletionProposalComputer.java
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/AbstractComponent.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/taglibs/Ajax4jsf.xml
Log:
https://jira.jboss.org/browse/JBIDE-7189 Tag autocomplete works incorrectly
Added:
trunk/jsf/tests/org.jboss.tools.jsf.test/projects/TestKbModel/WebContent/pages/actionparam.xhtml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.test/projects/TestKbModel/WebContent/pages/actionparam.xhtml
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.test/projects/TestKbModel/WebContent/pages/actionparam.xhtml 2010-09-30
15:16:14 UTC (rev 25339)
@@ -0,0 +1,11 @@
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:rich="http://richfaces.org/rich"
+
xmlns:a4j="http://richfaces.org/a4j">
+<ui:composition template="hr-layout.xhtml">
+ <a4j:actionparam name="" value="" />
+</ui:composition>
+</html>
\ No newline at end of file
Property changes on:
trunk/jsf/tests/org.jboss.tools.jsf.test/projects/TestKbModel/WebContent/pages/actionparam.xhtml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/kb/test/FaceletsKbModelTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/kb/test/FaceletsKbModelTest.java 2010-09-30
15:11:06 UTC (rev 25338)
+++
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/kb/test/FaceletsKbModelTest.java 2010-09-30
15:16:14 UTC (rev 25339)
@@ -101,6 +101,7 @@
/**
*
https://jira.jboss.org/jira/browse/JBIDE-6284
+ *
https://jira.jboss.org/browse/JBIDE-7210
*/
public void testFFacet() {
IFile file = testProject.getFile("WebContent/pages/inputUserName.xhtml");
@@ -113,16 +114,47 @@
query.setUri("http://java.sun.com/jsf/core");
query.setValue("f:facet");
- TextProposal[] proposals = PageProcessor.getInstance().getProposals(query, context);
+ TextProposal[] proposals = PageProcessor.getInstance().getProposals(query, context,
true);
+ boolean ok = false;
for (TextProposal proposal : proposals) {
if("<f:facet
name=\"\">".equals(proposal.getReplacementString())) {
- return;
+ ok = true;
}
+ if(proposal.getReplacementString().endsWith("/>")) {
+ fail("<f:facet /> proposal found.");
+ }
}
- fail("Can't find <f:facet name=\"\"> proposal.");
+ assertTrue("Can't find <f:facet name=\"\"> proposal.",
ok);
}
/**
+ *
https://jira.jboss.org/browse/JBIDE-7210
+ */
+ public void testActionparam() {
+ IFile file = testProject.getFile("WebContent/pages/actionparam.xhtml");
+ ELContext context = PageContextFactory.createPageContext(file);
+ KbQuery query = new KbQuery();
+ query.setMask(true);
+ query.setOffset(400);
+ query.setType(Type.TAG_NAME);
+ query.setPrefix("a4j");
+
query.setUri("http://richfaces.org/a4j");
+ query.setValue("a4j:actionpara");
+
+ TextProposal[] proposals = PageProcessor.getInstance().getProposals(query, context,
true);
+ boolean ok = false;
+ for (TextProposal proposal : proposals) {
+ if("<a4j:actionparam name=\"\" value=\"\"
/>".equals(proposal.getReplacementString())) {
+ ok = true;
+ }
+ if(proposal.getReplacementString().endsWith(" >")) {
+ fail("Not closed <a4j:actionparam > proposal found.");
+ }
+ }
+ assertTrue("Can't find <a4j:actionparam name=\"\"
value=\"\" /> proposal.", ok);
+ }
+
+ /**
*
https://jira.jboss.org/jira/browse/JBIDE-5231
*/
public void testSeamPdf() {
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/XmlTagCompletionProposalComputer.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/XmlTagCompletionProposalComputer.java 2010-09-30
15:11:06 UTC (rev 25338)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/XmlTagCompletionProposalComputer.java 2010-09-30
15:16:14 UTC (rev 25339)
@@ -322,7 +322,7 @@
String stringQuery = "<" + query; //$NON-NLS-1$
KbQuery kbQuery = createKbQuery(Type.TAG_NAME, query, stringQuery, prefix, uri);
- TextProposal[] proposals = PageProcessor.getInstance().getProposals(kbQuery,
getContext());
+ TextProposal[] proposals = PageProcessor.getInstance().getProposals(kbQuery,
getContext(), true);
for (int i = 0; proposals != null && i < proposals.length; i++) {
TextProposal textProposal = proposals[i];
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 2010-09-30
15:11:06 UTC (rev 25338)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageProcessor.java 2010-09-30
15:16:14 UTC (rev 25339)
@@ -12,7 +12,10 @@
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.jboss.tools.common.el.core.resolver.ELContext;
import org.jboss.tools.common.el.core.resolver.ELResolver;
@@ -22,6 +25,7 @@
import org.jboss.tools.jst.web.kb.taglib.CustomTagLibManager;
import org.jboss.tools.jst.web.kb.taglib.IAttribute;
import org.jboss.tools.jst.web.kb.taglib.IComponent;
+import org.jboss.tools.jst.web.kb.taglib.ICustomTagLibComponent;
import org.jboss.tools.jst.web.kb.taglib.ICustomTagLibrary;
import org.jboss.tools.jst.web.kb.taglib.IFacesConfigTagLibrary;
import org.jboss.tools.jst.web.kb.taglib.ITagLibrary;
@@ -54,8 +58,52 @@
* @return
*/
public TextProposal[] getProposals(KbQuery query, ELContext context) {
- ArrayList<TextProposal> proposals = new ArrayList<TextProposal>();
+ return getProposals(query, context, false);
+ }
+ private List<TextProposal> excludeExtendedComponents(List<TextProposal>
proposals) {
+ Map<String, Set<TextProposal>> runtimeComponentMap = new HashMap<String,
Set<TextProposal>>();
+ Map<String, TextProposal> customComponentMap = new HashMap<String,
TextProposal>();
+ for (TextProposal proposal : proposals) {
+ Object source = proposal.getSource();
+ if(source instanceof IComponent) {
+ IComponent component = (IComponent)source;
+ String name = component.getTagLib().getURI() + ":" + component.getName();
//$NON-NLS-1$
+ if(source instanceof ICustomTagLibComponent) {
+ customComponentMap.put(name, proposal);
+ } else {
+ Set<TextProposal> textProposals = runtimeComponentMap.get(name);
+ if(textProposals==null) {
+ textProposals = new HashSet<TextProposal>();
+ }
+ textProposals.add(proposal);
+ runtimeComponentMap.put(name, textProposals);
+ }
+ }
+ }
+ if(!customComponentMap.isEmpty()) {
+ proposals.clear();
+ for (String name : runtimeComponentMap.keySet()) {
+ TextProposal customProposal = customComponentMap.get(name);
+ if(customProposal!=null) {
+ proposals.add(customProposal);
+ } else {
+ proposals.addAll(runtimeComponentMap.get(name));
+ }
+ }
+ }
+ return proposals;
+ }
+
+ /**
+ *
+ * @param query
+ * @param context
+ * @return
+ */
+ public TextProposal[] getProposals(KbQuery query, ELContext context, boolean
preferCustomComponentExtensions) {
+ List<TextProposal> proposals = new ArrayList<TextProposal>();
+
if (!isQueryForELProposals(query, context)) {
if(context instanceof IPageContext) {
IPageContext pageContext = (IPageContext)context;
@@ -96,6 +144,9 @@
proposals.add(libProposals[j]);
}
}
+ if(preferCustomComponentExtensions && query.getType() ==
KbQuery.Type.TAG_NAME) {
+ proposals = excludeExtendedComponents(proposals);
+ }
}
} else {
String value = query.getValue();
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractComponent.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractComponent.java 2010-09-30
15:11:06 UTC (rev 25338)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractComponent.java 2010-09-30
15:16:14 UTC (rev 25339)
@@ -46,7 +46,7 @@
public static final String COMPONENT_TYPE = "component-type"; //$NON-NLS-1$
public static final String BODY_CONTENT = "bodycontent"; //$NON-NLS-1$
- protected boolean canHaveBody;
+ protected boolean canHaveBody = true;
protected String componentClass;
protected String componentType;
protected String description;
@@ -78,7 +78,7 @@
* @param s
*/
public void setCanHaveBody(IValueInfo s) {
- canHaveBody = s == null || "empty".equals(s.getValue()); //$NON-NLS-1$
+ canHaveBody = s == null || !"empty".equals(s.getValue()); //$NON-NLS-1$
attributesInfo.put(BODY_CONTENT, s);
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/taglibs/Ajax4jsf.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/taglibs/Ajax4jsf.xml 2010-09-30 15:11:06
UTC (rev 25338)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/taglibs/Ajax4jsf.xml 2010-09-30 15:16:14
UTC (rev 25339)
@@ -79,13 +79,15 @@
</attribute>
</component>
- <component name="actionparam">
+ <component closeTag="true" name="actionparam">
<attribute name="noEscape">
<proposal type="enumeration">
<param value="true" />
<param value="false" />
</proposal>
</attribute>
+ <attribute name="name" required="true"/>
+ <attribute name="value" required="true"/>
</component>
<component name="commandButton">
<attribute name="image">