Several fixes in synchronization schema

This commit is contained in:
no_reply@jetbrains.com
2005-02-03 21:38:40 +03:00
parent 046a07de55
commit 8d9d0a6255
4 changed files with 20 additions and 7 deletions
@@ -6,6 +6,7 @@ import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiFile;
import com.intellij.psi.impl.DebugUtil;
import com.intellij.psi.impl.source.jsp.JspxFileImpl;
import java.io.File;
import java.io.FileNotFoundException;
@@ -36,6 +37,7 @@ public abstract class ParsingTestCase extends LightIdeaTestCase {
else{
toParseTreeText(file);
}
if(file instanceof JspxFileImpl) ((JspxFileImpl)file).checkAllTreesEqual();
}
protected void checkResult(String targetDataName, final PsiFile file) throws Exception {
+10 -3
View File
@@ -29,9 +29,15 @@ public class DebugUtil {
public static String treeToString(ASTNode root, boolean skipWhitespaces) {
StringBuffer buffer = new StringBuffer();
treeToBuffer(buffer, root, 0, skipWhitespaces);
treeToBuffer(buffer, root, 0, skipWhitespaces, false);
return buffer.toString();
}
public static String treeToString(ASTNode root, boolean skipWhitespaces, boolean showRanges) {
StringBuffer buffer = new StringBuffer();
treeToBuffer(buffer, root, 0, skipWhitespaces, showRanges);
return buffer.toString();
}
public static String treeToStringWithUserData(TreeElement root, boolean skipWhitespaces) {
StringBuffer buffer = new StringBuffer();
@@ -63,7 +69,7 @@ public class DebugUtil {
}
}
private static void treeToBuffer(StringBuffer buffer, ASTNode root, int indent, boolean skipWhiteSpaces) {
private static void treeToBuffer(StringBuffer buffer, ASTNode root, int indent, boolean skipWhiteSpaces, boolean showRanges) {
if (skipWhiteSpaces && root.getElementType() == ElementType.WHITE_SPACE) return;
for (int i = 0; i < indent; i++) {
@@ -85,6 +91,7 @@ public class DebugUtil {
text = StringUtil.replace(text, "\t", "\\t");
buffer.append(root.toString() + "('" + text + "')");
}
if(showRanges) buffer.append(root.getTextRange());
buffer.append("\n");
if (root instanceof CompositeElement) {
ChameleonTransforming.transformChildren(root);
@@ -98,7 +105,7 @@ public class DebugUtil {
}
else {
while (child != null) {
treeToBuffer(buffer, child, indent + 2, skipWhiteSpaces);
treeToBuffer(buffer, child, indent + 2, skipWhiteSpaces, false);
child = child.getTreeNext();
}
}
@@ -251,8 +251,8 @@ public class CodeStyleManagerImpl extends CodeStyleManagerEx implements ProjectC
ASTNode next = element.getTreeNext();
ASTNode space1 = Helper.splitSpaceElement((TreeElement)element, end - spaceStart, charTable);
ASTNode tempElement = Factory.createSingleLeafElement(
ElementType.NEW_LINE_INDENT, "###".toCharArray(), 0,
"###".length(), charTable, null);
ElementType.NEW_LINE_INDENT, "xxx".toCharArray(), 0,
"xxx".length(), charTable, null);
parent.addChild(tempElement, space1.getTreeNext());
tempElement = new IndentAdjusterFacade(getSettings(), helper).adjustIndent(tempElement);
offset = tempElement.getTextRange().getStartOffset();
+6 -2
View File
@@ -508,7 +508,8 @@ public class XmlUtil {
final FileType fileType = file.getFileType();
if (fileType == StdFileTypes.HTML ||
fileType == StdFileTypes.XHTML
fileType == StdFileTypes.XHTML ||
fileType == StdFileTypes.JSPX
) {
return XHTML_URI;
}
@@ -811,7 +812,10 @@ public class XmlUtil {
}
public static String decode(String text){
if(text.charAt(0) != '&' || text.length() > 6 || text.length() < 3) return text;
if(text.charAt(0) != '&' || text.length() > 6 || text.length() < 3){
if(text.indexOf('<') < 0 && text.indexOf('>') < 0) return text;
return text.replaceAll("<!\\[CDATA\\[", "").replaceAll("\\]\\]>", "");
}
if(text.equals("&lt;")) {
return "<";