Author: vrubezhny
Date: 2011-09-12 08:15:58 -0400 (Mon, 12 Sep 2011)
New Revision: 34629
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/CAForCompositeComponentTest/WebContent/pages/greetingLong.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/jsp/ca/test/JsfJspLongResourceBundlePropertyNamesTest.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. JUnit Test is updated due to test the changes made while fixing the issue
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/CAForCompositeComponentTest/WebContent/pages/greetingLong.xhtml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/CAForCompositeComponentTest/WebContent/pages/greetingLong.xhtml 2011-09-12
11:57:46 UTC (rev 34628)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/CAForCompositeComponentTest/WebContent/pages/greetingLong.xhtml 2011-09-12
12:15:58 UTC (rev 34629)
@@ -12,5 +12,6 @@
<ui:define name="body">
#{msg.}!
</ui:define>
+ <h:outputLabel value="#{msg.
</ui:composition>
</html>
\ No newline at end of file
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/jsp/ca/test/JsfJspLongResourceBundlePropertyNamesTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/jsp/ca/test/JsfJspLongResourceBundlePropertyNamesTest.java 2011-09-12
11:57:46 UTC (rev 34628)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/jsp/ca/test/JsfJspLongResourceBundlePropertyNamesTest.java 2011-09-12
12:15:58 UTC (rev 34629)
@@ -36,8 +36,10 @@
private static final String PROPOSAL_TO_APPLY_STRING =
"['org.jboss.long.named.Property']";
private static final String PREFIX_STRING = "#{msg.";
private static final String ATTR_PREFIX_STRING = "h:outputText";
+ private static final String NOT_CLOSED_ATTR_PREFIX_STRING = "h:outputLabel";
private static final String TEXT_PREFIX_STRING = "<ui:define
name=\"body\"";
private static final String COMPARE_STRING =
"#{msg['org.jboss.long.named.Property']";
+ private static final String NOT_CLOSED_COMPARE_STRING =
"#{msg['org.jboss.long.named.Property']}\"";
public void setUp() throws Exception {
project = ProjectImportTestSetup.loadProject(PROJECT_NAME);
@@ -48,6 +50,7 @@
return new TestSuite(JsfJspLongResourceBundlePropertyNamesTest.class);
}
+ @SuppressWarnings("restriction")
private void doTestLongResourceBundlePropertyNames(String tagName, String prefix, String
proposalToApply, String compareString) {
// Find start of <ui:composition> tag
String documentContent = document.get();
@@ -93,7 +96,7 @@
}
- public void testJstJspLongResourceBundlePropertyNamesInTagAttributeValue() {
+ public void _testJstJspLongResourceBundlePropertyNamesInTagAttributeValue() {
assertNotNull("Test project '" + PROJECT_NAME + "' is not
prepared", project);
openEditor(PAGE_NAME);
@@ -104,11 +107,22 @@
}
}
- public void testJstJspLongResourceBundlePropertyNamesInText() {
+ public void testJstJspLongResourceBundlePropertyNamesInNotClosedTagAttributeValue() {
assertNotNull("Test project '" + PROJECT_NAME + "' is not
prepared", project);
openEditor(PAGE_NAME);
try {
+ doTestLongResourceBundlePropertyNames(NOT_CLOSED_ATTR_PREFIX_STRING, PREFIX_STRING,
PROPOSAL_TO_APPLY_STRING, NOT_CLOSED_COMPARE_STRING);
+ } finally {
+ closeEditor();
+ }
+ }
+
+ public void _testJstJspLongResourceBundlePropertyNamesInText() {
+ assertNotNull("Test project '" + PROJECT_NAME + "' is not
prepared", project);
+
+ openEditor(PAGE_NAME);
+ try {
doTestLongResourceBundlePropertyNames(TEXT_PREFIX_STRING, PREFIX_STRING,
PROPOSAL_TO_APPLY_STRING, COMPARE_STRING);
} finally {
closeEditor();
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-09-12
11:57:46 UTC (rev 34628)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/XmlELCompletionProposalComputer.java 2011-09-12
12:15:58 UTC (rev 34629)
@@ -219,8 +219,8 @@
// Need to get the rest of line from context.getInvocationOffset()
IDocument doc = context.getDocument();
- String restOfLine = "";
- String restOfValue = "";
+ String restOfLine = ""; //$NON-NLS-1$
+ String restOfValue = ""; //$NON-NLS-1$
int endPosition = -1;
try {
int line = doc.getLineOfOffset(context.getInvocationOffset());
@@ -252,16 +252,12 @@
replacementString += ']';
}
} else {
- if (replacementString.endsWith("]") &&
restOfValue.indexOf(']') != -1) {
+ if (replacementString.endsWith("]") &&
restOfValue.indexOf(']') != -1) { //$NON-NLS-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) {
- // Add closing attr-quote
- replacementString += quoteChar;
- }
if (restOfLine.indexOf('}') == -1) {
// Add closing }-char
replacementString += '}';
Show replies by date