[304369] Slow performance (or even crash) when opening large XML file
diff --git a/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/XMLModelParser.java b/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/XMLModelParser.java
index 3c5fb3a..683b5ac 100644
--- a/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/XMLModelParser.java
+++ b/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/XMLModelParser.java
@@ -42,7 +42,7 @@
public class XMLModelParser {
private XMLModelContext context = null;
private DOMModelImpl model = null;
- private TextImpl previousText = null;
+ private TextImpl lastTextNode = null;
/**
*/
@@ -1145,7 +1145,10 @@
if (text != null) { // existing text found
// do not append data
text.appendStructuredDocumentRegion(flatNode);
- previousText = text;
+ // Adjacent text nodes, where changes were queued
+ if (lastTextNode != null && lastTextNode != text)
+ lastTextNode.notifyValueChanged();
+ lastTextNode = text;
return;
}
@@ -1520,10 +1523,10 @@
isTextNode = true;
}
- /* Changes to text regions are queued up, and once the value is done changing a notification is sent */
- if (!isTextNode && previousText != null) {
- previousText.notifyValueChanged();
- previousText = null;
+ // Changes to text regions are queued up, and once the value is done changing a notification is sent
+ if (!isTextNode && lastTextNode != null) {
+ lastTextNode.notifyValueChanged();
+ lastTextNode = null;
}
}
@@ -1562,7 +1565,10 @@
TextImpl text = (TextImpl) this.context.findPreviousText();
if (text != null) { // existing text found
text.appendStructuredDocumentRegion(flatNode);
- previousText = text;
+ // Adjacent text nodes, where changes were queued
+ if (lastTextNode != null && lastTextNode != text)
+ lastTextNode.notifyValueChanged();
+ lastTextNode = text;
return;
}