Author: vrubezhny
Date: 2011-11-10 17:14:58 -0500 (Thu, 10 Nov 2011)
New Revision: 36287
Modified:
trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/ca/ELProposalProcessor.java
Log:
JBIDE-9910 Proposal info for message bundles in code completion for EL
Fix CA filtering for resource bundle property proposals in Java files
Modified:
trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/ca/ELProposalProcessor.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/ca/ELProposalProcessor.java 2011-11-10
21:23:19 UTC (rev 36286)
+++
trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/ca/ELProposalProcessor.java 2011-11-10
22:14:58 UTC (rev 36287)
@@ -96,6 +96,7 @@
private final int fOffset;
private int fNewPosition;
private String fDisplayString;
+ private String fAlternateMatch;
private String fAdditionalProposalInfo;
private IJavaElement[] fJavaElements;
private MessagesELTextProposal fPropertySource;
@@ -107,18 +108,18 @@
}
public Proposal(String string, String prefix, int offset, int newPosition) {
- this(string, prefix, prefix, offset, offset + string.length(), null, null, null, null,
null);
+ this(string, prefix, prefix, offset, offset + string.length(), null, null, null, null,
null, null);
}
- public Proposal(String string, String prefix, int offset, int newPosition, Image image,
String displayString, String additionalProposalInfo, IJavaElement[] javaElements,
MessagesELTextProposal propertySource) {
- this(string, prefix, prefix, offset, offset + string.length(), image, displayString,
additionalProposalInfo, javaElements, propertySource);
+/**/ public Proposal(String string, String prefix, int offset, int newPosition, Image
image, String displayString, String alternateMatch, String additionalProposalInfo,
IJavaElement[] javaElements, MessagesELTextProposal propertySource) {
+ this(string, prefix, prefix, offset, offset + string.length(), image, displayString,
alternateMatch, additionalProposalInfo, javaElements, propertySource);
}
public Proposal(String string, String prefix, String newPrefix, int offset, int
newPosition) {
- this(string, prefix, newPrefix, offset, newPosition, null, null, null, null, null);
+ this(string, prefix, newPrefix, offset, newPosition, null, null, null, null, null,
null);
}
- public Proposal(String string, String prefix, String newPrefix, int offset, int
newPosition, Image image, String displayString, String additionalProposalInfo,
IJavaElement[] javaElements, MessagesELTextProposal propertySource) {
+/**/ public Proposal(String string, String prefix, String newPrefix, int offset, int
newPosition, Image image, String displayString, String alternateMatch, String
additionalProposalInfo, IJavaElement[] javaElements, MessagesELTextProposal
propertySource) {
fString = string;
fPrefix = prefix;
fNewPrefix = newPrefix;
@@ -126,6 +127,7 @@
fNewPosition = newPosition;
fImage = image;
fDisplayString = displayString;
+ fAlternateMatch = alternateMatch;
fAdditionalProposalInfo = additionalProposalInfo;
fJavaElements = javaElements;
if (fJavaElements != null && fJavaElements.length > 0)
@@ -405,7 +407,9 @@
public boolean validate(IDocument document, int offset, DocumentEvent event) {
try {
int prefixStart= fOffset - fPrefix.length();
- return offset >= fOffset && offset < fOffset + fString.length()
&& document.get(prefixStart, offset - (prefixStart)).equals((fPrefix +
fString).substring(0, offset - prefixStart));
+ return offset >= fOffset &&
+ ((offset < fOffset + fString.length() && document.get(prefixStart,
offset - (prefixStart)).equals((fPrefix + fString).substring(0, offset - prefixStart))) ||
+ (fAlternateMatch != null && offset < fOffset +
fAlternateMatch.length() && document.get(prefixStart, offset -
(prefixStart)).equals((fPrefix + fAlternateMatch).substring(0, offset - prefixStart))));
} catch (BadLocationException x) {
return false;
}
@@ -453,6 +457,14 @@
return TextProposal.R_JSP_JSF_EL_VARIABLE_ATTRIBUTE_VALUE+10;
}
+ public String getfAlternateMatch() {
+ return fAlternateMatch;
+ }
+
+ public void setfAlternateMatch(String fAlternateMatch) {
+ this.fAlternateMatch = fAlternateMatch;
+ }
+
}
/**
@@ -612,7 +624,7 @@
string += proposalSufix;
resultList.add(new Proposal(string, prefix, newPrefix, offset, offset -
(prefix.length() - newPrefix.length()) + string.length() - proposalSufix.length(), image,
- kbProposal.getLabel(), additionalProposalInfo, javaElements, source));
+ kbProposal.getLabel(), kbProposal.getAlternateMatch(), additionalProposalInfo,
javaElements, source));
} else {
if (string.indexOf('\'') != -1 &&
restOfEL.indexOf('\'') != -1) // Exclude last quote if this char already
exists
string = string.substring(0, string.lastIndexOf('\''));
@@ -622,7 +634,7 @@
string += proposalSufix;
resultList.add(new Proposal(string, prefix, offset, offset + string.length() -
proposalSufix.length(), image,
- kbProposal.getLabel(), additionalProposalInfo, javaElements, source));
+ kbProposal.getLabel(), kbProposal.getAlternateMatch(), additionalProposalInfo,
javaElements, source));
}
}
}