Author: scabanovich
Date: 2011-05-12 15:56:11 -0400 (Thu, 12 May 2011)
New Revision: 31269
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/contentassist/SeamConfigXmlCompletionProposalComputer.java
Log:
JBIDE-8941
https://issues.jboss.org/browse/JBIDE-8941
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/contentassist/SeamConfigXmlCompletionProposalComputer.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/contentassist/SeamConfigXmlCompletionProposalComputer.java 2011-05-12
19:46:32 UTC (rev 31268)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/contentassist/SeamConfigXmlCompletionProposalComputer.java 2011-05-12
19:56:11 UTC (rev 31269)
@@ -298,8 +298,10 @@
boolean isEnded = (node.getNodeType() != Node.TEXT_NODE) &&
node.getFirstStructuredDocumentRegion().isEnded();
if(currentNode == parentElement) {
- parentElement = (Element)parentElement.getParentNode();
- sax = sax.getParent();
+ if(parentElement.getParentNode() instanceof Element) {
+ parentElement = (Element)parentElement.getParentNode();
+ sax = sax.getParent();
+ }
}
String match = contentAssistRequest.getMatchString();
@@ -330,17 +332,9 @@
}
}
- private void createProposal(ContentAssistRequest contentAssistRequest, String tagText,
String displayText, int positionAdjustment, IMember member, int relevance) {
+ private void createProposal(ContentAssistRequest contentAssistRequest, String tagText,
String displayText, int positionAdjustment, final IMember member, int relevance) {
int begin = contentAssistRequest.getReplacementBeginPosition();
int length = contentAssistRequest.getReplacementLength();
- String proposedInfo = null;
- if(member != null) {
- try {
- proposedInfo = JavadocContentAccess2.getHTMLContent(member, true);
- } catch (JavaModelException e) {
- CDISeamConfigUIPlugin.log(e);
- }
- }
String imagePath = XMLEditorPluginImages.IMG_OBJ_TAG_GENERIC;
if(tagText.endsWith("\"")) { //improve that dirty hack
imagePath = XMLEditorPluginImages.IMG_OBJ_ATTRIBUTE;
@@ -348,7 +342,21 @@
CustomCompletionProposal textProposal = new CustomCompletionProposal(
tagText, begin, length, positionAdjustment,
XMLEditorPluginImageHelper.getInstance().getImage(imagePath),
- displayText, null, proposedInfo, relevance);
+ displayText, null, null, relevance) {
+ String proposedInfo = null;
+ public String getAdditionalProposalInfo() {
+ if(member != null && proposedInfo == null) {
+ try {
+ proposedInfo = JavadocContentAccess2.getHTMLContent(member, true);
+ if(proposedInfo == null) proposedInfo = "";
+ } catch (JavaModelException e) {
+ CDISeamConfigUIPlugin.log(e);
+ }
+ }
+ return proposedInfo;
+ }
+
+ };
contentAssistRequest.addProposal(textProposal);
}