Author: vrubezhny
Date: 2008-09-05 14:00:32 -0400 (Fri, 05 Sep 2008)
New Revision: 10105
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalProcessor.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2498 CA shows proposals which begisn with #{ for
EL which begins with ${ elements
Issue is fixed
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalProcessor.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalProcessor.java 2008-09-05
15:29:00 UTC (rev 10104)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalProcessor.java 2008-09-05
18:00:32 UTC (rev 10105)
@@ -291,6 +291,7 @@
String proposalPrefix = "";
String proposalSufix = "";
+ String elStartChar = "#";
String documentContent = null;
IDocument document = viewer.getDocument();
if (!checkStartPositionInEL(viewer, offset)) {
@@ -299,8 +300,11 @@
return NO_PROPOSALS;
}
prefix = ""; // Clear prefix because it's not the part of EL
- if(isCharSharp(viewer, offset-1)) {
+ if(isCharSharp(viewer, offset-1) || isCharDollar(viewer, offset-1)) {
proposalPrefix = "{"; //$NON-NLS-1$
+ if (isCharDollar(viewer, offset-1)) {
+ elStartChar = "$";
+ }
} else {
proposalPrefix = "#{"; //$NON-NLS-1$
}
@@ -328,6 +332,9 @@
for (String string : uniqueSuggestions) {
if (string.length() >= 0) {
string = proposalPrefix + string + proposalSufix;
+ if ('#' == string.charAt(0) || '$' == string.charAt(0))
+ string = elStartChar + string.substring(1);
+
if (string.startsWith("['") &&
string.endsWith("']") && prefix != null &&
prefix.endsWith(".")) {
String newPrefix = prefix.substring(0, prefix.length() - 1);
result.add(new Proposal(string, prefix, newPrefix, offset, offset - 1 +
string.length() - proposalSufix.length()));
@@ -462,6 +469,15 @@
return '#' == doc.getChar(offset);
}
+ private boolean isCharDollar(ITextViewer viewer, int offset) throws BadLocationException
{
+ IDocument doc= viewer.getDocument();
+ if (doc == null || offset > doc.getLength() || offset < 0) {
+ return false;
+ }
+
+ return '$' == doc.getChar(offset);
+ }
+
/*
* Checks if the EL start starting characters are present
* @param viewer