Author: vrubezhny
Date: 2009-12-07 16:24:07 -0500 (Mon, 07 Dec 2009)
New Revision: 19083
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java
Log:
JBIDE-4877: completion in xhtml should not require namespace to match on tag
CA proposal for the tag names calculation is modified
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java 2009-12-07
18:49:25 UTC (rev 19082)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java 2009-12-07
21:24:07 UTC (rev 19083)
@@ -102,7 +102,7 @@
return;
}
- addTagNameProposals(contentAssistRequest, childPosition);
+ addTagNameProposals(contentAssistRequest, childPosition, true);
}
private void addTagNameProposalsForPrefix(
@@ -111,8 +111,8 @@
String query,
String prefix,
String uri,
- int defaultRelevance
- ) {
+ int defaultRelevance,
+ boolean insertTagOpenningCharacter) {
if (query == null)
query = ""; //$NON-NLS-1$
String stringQuery = "<" + query; //$NON-NLS-1$
@@ -129,7 +129,7 @@
closingTag = closingTag.substring(1);
}
- if (replacementString.startsWith("<")) { //$NON-NLS-1$
+ if (!insertTagOpenningCharacter &&
replacementString.startsWith("<")) { //$NON-NLS-1$
// Because the tag starting char is already in the text
replacementString = replacementString.substring(1);
}
@@ -162,6 +162,7 @@
}
}
+
/**
* Calculates and adds the tag name proposals to the Content Assist Request object
*
@@ -171,12 +172,23 @@
@Override
protected void addTagNameProposals(
ContentAssistRequest contentAssistRequest, int childPosition) {
+ addTagNameProposals(contentAssistRequest, childPosition, false);
+ }
+ /**
+ * Calculates and adds the tag name proposals to the Content Assist Request object
+ *
+ * @param contentAssistRequest Content Assist Request object
+ * @param childPosition the
+ */
+ protected void addTagNameProposals(
+ ContentAssistRequest contentAssistRequest, int childPosition, boolean
insertTagOpenningCharacter) {
+
String mainPrefix = getTagPrefix();
String mainURI = getTagUri();
String query = contentAssistRequest.getMatchString();
- addTagNameProposalsForPrefix(contentAssistRequest, childPosition, query, mainPrefix,
mainURI, TextProposal.R_TAG_INSERTION);
+ addTagNameProposalsForPrefix(contentAssistRequest, childPosition, query, mainPrefix,
mainURI, TextProposal.R_TAG_INSERTION, insertTagOpenningCharacter);
if (query == null || query.length() == 0 || query.contains(":"))
//$NON-NLS-1$
return;
@@ -200,7 +212,8 @@
String possibleQuery = namespace.getPrefix() + ":" + query; //$NON-NLS-1$
addTagNameProposalsForPrefix(contentAssistRequest, childPosition,
possibleQuery, possiblePrefix, possibleURI,
- TextProposal.R_TAG_INSERTION - 1);
+ TextProposal.R_TAG_INSERTION - 1,
+ insertTagOpenningCharacter);
}
}
}
Show replies by date