Author: vrubezhny
Date: 2011-08-02 12:13:18 -0400 (Tue, 02 Aug 2011)
New Revision: 33453
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/FaceletsELCompletionProposalComputer.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/XmlELCompletionProposalComputer.java
Log:
JBIDE-9414
CA incorrectly inserts a long-named properties from resource bundles
Issue is fixed
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/FaceletsELCompletionProposalComputer.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/FaceletsELCompletionProposalComputer.java 2011-08-02
13:14:32 UTC (rev 33452)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/FaceletsELCompletionProposalComputer.java 2011-08-02
16:13:18 UTC (rev 33453)
@@ -190,7 +190,13 @@
for (TextProposal textProposal : proposals) {
int replacementOffset = beginChangeOffset;
int replacementLength = prefix.getLength();
- String replacementString = prefix.getText().substring(0, replacementLength) +
textProposal.getReplacementString();
+ String replacementString = prefix.getText().substring(0, replacementLength);
+ if (textProposal.getReplacementString().trim().startsWith("[") &&
replacementString.endsWith(".")) { //$NON-NLS-1$ //$NON-NLS-2$
+ // Need to include last '.' (dot) char into the string to replace
+ replacementString = replacementString.substring(0, replacementString.length() - 1);
+ }
+ replacementString += textProposal.getReplacementString();
+
int cursorPosition = replacementString.length();
// Check if it is a long named property to be inserted
@@ -231,6 +237,11 @@
// Closing ']' is to be added
replacementString += ']';
}
+ } else {
+ if (replacementString.endsWith("]") &&
restOfValue.indexOf(']') != -1) {
+ replacementString = replacementString.substring(0, replacementString.length() -1);
+ cursorPosition = replacementString.length(); // Cursor will be put right after the
replacement (not after the closing square bracket in this case)
+ }
}
if (restOfLine.indexOf('}') == -1) {
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/XmlELCompletionProposalComputer.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/XmlELCompletionProposalComputer.java 2011-08-02
13:14:32 UTC (rev 33452)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/XmlELCompletionProposalComputer.java 2011-08-02
16:13:18 UTC (rev 33453)
@@ -187,7 +187,12 @@
for (TextProposal textProposal : proposals) {
int replacementOffset = beginChangeOffset;
int replacementLength = prefix.getLength();
- String replacementString = prefix.getText().substring(0, replacementLength) +
textProposal.getReplacementString();
+ String replacementString = prefix.getText().substring(0, replacementLength);
+ if (textProposal.getReplacementString().trim().startsWith("[") &&
replacementString.endsWith(".")) { //$NON-NLS-1$ //$NON-NLS-2$
+ // Need to include last '.' (dot) char into the string to replace
+ replacementString = replacementString.substring(0, replacementString.length() - 1);
+ }
+ replacementString += textProposal.getReplacementString();
char quoteChar = prefix.isAttributeValue() && prefix.hasOpenQuote() ?
prefix.getQuoteChar() : '"';
// if (prefix.isAttributeValue() && !prefix.hasOpenQuote()) {
@@ -234,6 +239,11 @@
// Closing ']' is to be added
replacementString += ']';
}
+ } else {
+ if (replacementString.endsWith("]") &&
restOfValue.indexOf(']') != -1) {
+ replacementString = replacementString.substring(0, replacementString.length() -1);
+ cursorPosition = replacementString.length(); // Cursor will be put right after the
replacement (not after the closing square bracket in this case)
+ }
}
if (prefix.isAttributeValue() && prefix.hasOpenQuote() && endPosition
== -1) {
Show replies by date