Author: scabanovich
Date: 2007-10-12 11:17:56 -0400 (Fri, 12 Oct 2007)
New Revision: 4164
Modified:
trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbHtmlStore.java
trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/wtp/JspWtpKbConnector.java
trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/wtp/WtpKbConnector.java
Log:
JBIDE-525
Modified:
trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbHtmlStore.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbHtmlStore.java 2007-10-12
14:16:33 UTC (rev 4163)
+++
trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/KbHtmlStore.java 2007-10-12
15:17:56 UTC (rev 4164)
@@ -15,6 +15,7 @@
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.Map;
import java.util.StringTokenizer;
@@ -439,11 +440,52 @@
}
}
}
+ if(enumeration.size() == 0) {
+ enumeration = getAttributeValueProposals(attributeType, valueMask);
+ }
}
return enumeration;
}
+ private ArrayList<KbProposal> getAttributeValueProposals(Element attributeType,
String valueMask) {
+ ArrayList<KbProposal> proposals = new ArrayList<KbProposal>();
+
+ NodeList nodeList =
attributeType.getElementsByTagName(SchemaNodeFactory.PROPOSAL_NODE);
+ for(int i = 0; i < nodeList.getLength(); i++) {
+ Element proposalElement = (Element)nodeList.item(i);
+ String type = proposalElement.getAttribute(SchemaNodeFactory.TYPE_ATTRIBUTE);
+ if(type.equals(SchemaNodeFactory.ENUMERATION_TYPE)) {
+ proposals.addAll(getEnumeration(proposalElement, valueMask));
+ continue;
+ }
+ }
+
+ return proposals;
+ }
+ private ArrayList<KbProposal> getEnumeration(Element proposalElement, String
valueMask) {
+ ArrayList<KbProposal> enumeration = new ArrayList<KbProposal>();
+
+ NodeList nodeList =
proposalElement.getElementsByTagName(SchemaNodeFactory.PARAM_NODE);
+ for(int i=0; i<nodeList.getLength(); i++) {
+ Element paramElement = (Element)nodeList.item(i);
+ String value = paramElement.getAttribute(SchemaNodeFactory.VALUE_ATTRIBUTE);
+ if(value.startsWith(valueMask)) {
+ KbProposal proposal = new KbProposal();
+ proposal.setLabel(value);
+ proposal.setReplacementString(value);
+ proposal.setContextInfo(null);
+ proposal.setIcon(KbIcon.ENUM_ITEM);
+ proposal.setPosition(value.length());
+
+ enumeration.add(proposal);
+ }
+ }
+
+ return enumeration;
+ }
+
+
private ArrayList<KbProposal> getAttributeProposal(ArrayList<Element>
elements) {
return getProposal(elements, false);
}
Modified:
trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/wtp/JspWtpKbConnector.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/wtp/JspWtpKbConnector.java 2007-10-12
14:16:33 UTC (rev 4163)
+++
trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/wtp/JspWtpKbConnector.java 2007-10-12
15:17:56 UTC (rev 4164)
@@ -225,8 +225,13 @@
return (Collection)o;
}
}
+
+ KbStore store = KbTldStore.getInstance();
+ if(query.startsWith(ADD_HTML_PREFIX)) {
+ query = query.substring(ADD_HTML_PREFIX.length());
+ store = KbHtmlStore.getInstance();
+ }
- KbTldStore store = KbTldStore.getInstance();
KbQuery kbQuery = new KbQuery(query, registerResources, registretedDinamicResources);
Collection<KbProposal> proposals = store.queryProposal(kbQuery);
// Collection result = removeSameProposals(proposals);
Modified:
trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/wtp/WtpKbConnector.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/wtp/WtpKbConnector.java 2007-10-12
14:16:33 UTC (rev 4163)
+++
trunk/common/plugins/org.jboss.tools.common.kb/src/org/jboss/tools/common/kb/wtp/WtpKbConnector.java 2007-10-12
15:17:56 UTC (rev 4164)
@@ -22,7 +22,8 @@
* @author Igels
*/
public interface WtpKbConnector extends KbConnector {
-
+ public static String ADD_HTML_PREFIX = "4YTR:";
+
/**
*
* @param query