org.netbeans.modules.xml.xdm.visitor
Class Utils
java.lang.Object
org.netbeans.modules.xml.xdm.visitor.Utils
public class Utils
- extends Object
Utils.java
Created on November 16, 2004, 3:21 PM
|
Constructor Summary |
Utils()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Utils
public Utils()
replaceDocument
public static void replaceDocument(Document doc,
String newDoc,
String prefixMark)
throws BadLocationException
- This method update document in editor after change in beans hierarchy.
It takes old document and new document in String.
To avoid regeneration of whole document in text editor following steps are done:
1) compare the begin of both documents (old one and new one)
- find the first position where both documents differ
2) do the same from the ends of documents
3) remove old middle part of text (modified part) and insert new one
- Parameters:
doc - original documentnewDoc - new value of whole documentprefixMark - - beginning part of the document before this mark should be preserved
- Throws:
BadLocationException
replaceDocument
public static void replaceDocument(Document doc,
String newDoc)
throws BadLocationException
- Throws:
BadLocationException
filterEndLines
public static String filterEndLines(String str)
- Filter characters #13 (CR) from the specified String
- Parameters:
str - original string
- Returns:
- the string without #13 characters
loadDocument
public static BaseDocument loadDocument(String text)
throws IOException
- Throws:
IOException
parseFragment
public static NodeList parseFragment(String text)
throws IOException
- Throws:
IOException