Author: vrubezhny
Date: 2010-09-30 10:57:12 -0400 (Thu, 30 Sep 2010)
New Revision: 25336
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AutoELContentAssistantProposal.java
Log:
JBIDE-7168
Code completion inserts methods with parameters.
The cursor is placed inside the parentheses when a method with parameters is inserted by
EL CA
In case of method without parameters the cursor is placed after the closing parenthesis.
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AutoELContentAssistantProposal.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AutoELContentAssistantProposal.java 2010-09-30
14:47:16 UTC (rev 25335)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AutoELContentAssistantProposal.java 2010-09-30
14:57:12 UTC (rev 25336)
@@ -180,4 +180,27 @@
HTMLPrinter.addSmallHeader(buffer, getInfoText(element));
}
}
+
+ /**
+ * Return cursor position of proposal replacement string.
+ *
+ * Method is added because of JBIDE-7168
+ */
+ public int getCursorPosition() {
+ int cursorPosition = -1;
+
+ int openingQuoteInReplacement = getReplacementString().indexOf('(');
+ int closingQuoteInReplacement = getReplacementString().indexOf(')');
+ int openingQuoteInDisplay = getDisplayString().indexOf('(');
+ int closingQuoteInDisplay = getDisplayString().indexOf(')');
+
+ if (openingQuoteInReplacement != -1 && closingQuoteInReplacement != -1
&&
+ openingQuoteInDisplay != -1 && closingQuoteInDisplay != -1 &&
+ (closingQuoteInReplacement - openingQuoteInReplacement) !=
+ (closingQuoteInDisplay - openingQuoteInDisplay)) {
+ cursorPosition = openingQuoteInReplacement + 1;
+ }
+
+ return cursorPosition>-1?cursorPosition:super.getCursorPosition();
+ }
}
Show replies by date