Author: yzhishko
Date: 2010-03-16 14:35:16 -0400 (Tue, 16 Mar 2010)
New Revision: 20850
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/5143/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/5143/test.html
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/ExceptionInVPEComments_JBIDE5143.java
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
trunk/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlCommentTemplate.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5143 - fixed
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/5143/test.html
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/5143/test.html
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/5143/test.html 2010-03-16
18:35:16 UTC (rev 20850)
@@ -0,0 +1,10 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
+<title>Insert title here</title>
+</head>
+<body>
+ <span>Test --text</span>-->
+</body>
+</html>
\ No newline at end of file
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2010-03-16
17:19:22 UTC (rev 20849)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2010-03-16
18:35:16 UTC (rev 20850)
@@ -16,6 +16,7 @@
import org.jboss.tools.jsf.vpe.jsf.test.jbide.ChangeMessageBundleTest_JBIDE5818;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.ContextMenuDoubleInsertionTest_JBIDE3888;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.EditFontFamilyTest_JBIDE5872;
+import org.jboss.tools.jsf.vpe.jsf.test.jbide.ExceptionInVPEComments_JBIDE5143;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.FacetProcessingTest;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE1105Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE1460Test;
@@ -211,6 +212,7 @@
suite.addTestSuite(NaturesChecker_JBIDE5701.class);
suite.addTestSuite(FacetProcessingTest.class);
suite.addTestSuite(RefreshBundles_JBIDE5460.class);
+ suite.addTestSuite(ExceptionInVPEComments_JBIDE5143.class);
// $JUnit-END$
return new VpeTestSetup(suite);
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/ExceptionInVPEComments_JBIDE5143.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/ExceptionInVPEComments_JBIDE5143.java
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/ExceptionInVPEComments_JBIDE5143.java 2010-03-16
18:35:16 UTC (rev 20850)
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jsf.vpe.jsf.test.jbide;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.part.FileEditorInput;
+import org.jboss.tools.jsf.vpe.jsf.test.JsfAllTests;
+import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.vpe.ui.test.TestUtil;
+import org.jboss.tools.vpe.ui.test.VpeTest;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+public class ExceptionInVPEComments_JBIDE5143 extends VpeTest {
+
+ public ExceptionInVPEComments_JBIDE5143(String name) {
+ super(name);
+ }
+
+ public void testExceptionInVPEComments() throws Throwable {
+ setException(null);
+ IFile file = (IFile) TestUtil.getComponentPath("JBIDE/5143/test.html",
//$NON-NLS-1$
+ JsfAllTests.IMPORT_PROJECT_NAME);
+ IEditorInput editorInput = new FileEditorInput(file);
+ JSPMultiPageEditor part = openEditor(editorInput);
+ TestUtil.delay(3000);
+ TestUtil.waitForIdle();
+ StyledText styledText = part.getSourceEditor().getTextViewer()
+ .getTextWidget();
+ String delimiter = styledText.getLineDelimiter();
+ int offset = styledText.getOffsetAtLine(8);
+ styledText.setCaretOffset(offset - delimiter.length() - 28);
+ styledText.insert("-"); //$NON-NLS-1$
+ TestUtil.delay(1000);
+ TestUtil.waitForIdle();
+ styledText.insert("-"); //$NON-NLS-1$
+ TestUtil.delay(1000);
+ TestUtil.waitForIdle();
+ styledText.insert("!"); //$NON-NLS-1$
+ TestUtil.delay(1000);
+ TestUtil.waitForIdle();
+ styledText.insert("<"); //$NON-NLS-1$
+ TestUtil.delay(1000);
+ TestUtil.waitForIdle();
+ }
+
+}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlCommentTemplate.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlCommentTemplate.java 2010-03-16
17:19:22 UTC (rev 20849)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlCommentTemplate.java 2010-03-16
18:35:16 UTC (rev 20850)
@@ -28,7 +28,9 @@
* Template for comment node
*/
public class HtmlCommentTemplate extends VpeAbstractTemplate {
+
+ private static final String doubleHyphen = "--"; //$NON-NLS-1$
private static final String COMMENT_STYLE = "font-style:italic;
color:green"; //$NON-NLS-1$
/* (non-Javadoc)
* @see
org.jboss.tools.vpe.editor.template.VpeTemplate#create(org.jboss.tools.vpe.editor.context.VpePageContext,
org.w3c.dom.Node, org.mozilla.interfaces.nsIDOMDocument)
@@ -44,9 +46,21 @@
((nsIDOMElement)visualNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID)).appendChild(text);
} else {
- visualNode = visualDocument.createComment(sourceNode.getNodeValue());
+ visualNode =
visualDocument.createComment(removeDoubleHyphens(sourceNode.getNodeValue()));
}
return new VpeCreationData(visualNode);
}
+
+ //a part of
https://jira.jboss.org/jira/browse/JBIDE-5143 fix
+
+ private String removeDoubleHyphens(String value){
+ StringBuilder stringBuilder = new StringBuilder(""); //$NON-NLS-1$
+ while (value.indexOf(doubleHyphen)>-1) {
+ stringBuilder.append(value.substring(0, value.indexOf(doubleHyphen)));
+ value = value.substring(value.indexOf(doubleHyphen)+doubleHyphen.length());
+ }
+ stringBuilder.append(value);
+ return stringBuilder.toString();
+ }
}
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java 2010-03-16
17:19:22 UTC (rev 20849)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java 2010-03-16
18:35:16 UTC (rev 20850)
@@ -129,8 +129,12 @@
}
closeEditors();
-
+
Platform.removeLogListener(this);
+
+ if (getException() != null) {
+ throw new Exception(getException());
+ }
super.tearDown();