From 73074ff45c7784005cbcdad4b9e74df6e255ec08 Mon Sep 17 00:00:00 2001 From: "no_reply@jetbrains.com" Date: Wed, 9 Mar 2005 20:57:20 +0300 Subject: [PATCH] New chameleons and fix for problem with changed elements ordering in tree events --- .../intellij/psi/impl/source/text/BlockSupportImpl.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/source/com/intellij/psi/impl/source/text/BlockSupportImpl.java b/source/com/intellij/psi/impl/source/text/BlockSupportImpl.java index a669f6f2e8b1..63a33836c2cb 100644 --- a/source/com/intellij/psi/impl/source/text/BlockSupportImpl.java +++ b/source/com/intellij/psi/impl/source/text/BlockSupportImpl.java @@ -97,12 +97,10 @@ public class BlockSupportImpl extends BlockSupport implements Constants, Project final String newTextStr = StringFactory.createStringFromConstantArray(newFileText, textRange.getStartOffset(), textRange.getLength() + lengthShift); if(reparseable.isParsable(newTextStr)){ - final FileElement treeElement = new DummyHolder(((TreeElement)parent).getManager(), null, treeFileElement.getCharTable()).getTreeElement(); final ChameleonElement chameleon = - (ChameleonElement)Factory.createLeafElement(reparseable, newFileText, textRange.getStartOffset(), - textRange.getEndOffset() + lengthShift, -1, treeFileElement.getCharTable()); - TreeUtil.addChildren(treeElement, chameleon); - parent.replaceAllChildrenToChildrenOf(chameleon.transform(treeFileElement.getCharTable(), fileImpl.createLexer()).getTreeParent()); + (ChameleonElement)Factory.createSingleLeafElement(reparseable, newFileText, textRange.getStartOffset(), + textRange.getEndOffset() + lengthShift, null, null); + ChangeUtil.replaceAllChildren((CompositeElement)parent, reparseable.parseContents(chameleon).getTreeParent()); return; } else if(reparseable instanceof IErrorCounterChameleonElementType){