mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-21 21:52:10 +02:00
Bug 565628: Fix spelling of Indent in variable names
Change-Id: Ifb9124927a7c1afecede6e8bcd75ac8c09526422
This commit is contained in:
parent
149ccaffcc
commit
6f3cb8014b
1 changed files with 14 additions and 14 deletions
|
@ -53,7 +53,7 @@ import org.w3c.dom.NodeList;
|
||||||
public class XmlUtil {
|
public class XmlUtil {
|
||||||
private static final String ENCODING_UTF_8 = "UTF-8"; //$NON-NLS-1$
|
private static final String ENCODING_UTF_8 = "UTF-8"; //$NON-NLS-1$
|
||||||
private static final String EOL_XML = "\n"; //$NON-NLS-1$
|
private static final String EOL_XML = "\n"; //$NON-NLS-1$
|
||||||
private static final String DEFAULT_IDENT = "\t"; //$NON-NLS-1$
|
private static final String DEFAULT_INDENT = "\t"; //$NON-NLS-1$
|
||||||
private static String LINE_SEPARATOR = System.getProperty("line.separator"); //$NON-NLS-1$
|
private static String LINE_SEPARATOR = System.getProperty("line.separator"); //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -136,7 +136,7 @@ public class XmlUtil {
|
||||||
* @param doc - DOM document to be pretty printed
|
* @param doc - DOM document to be pretty printed
|
||||||
*/
|
*/
|
||||||
public static void prettyFormat(Document doc) {
|
public static void prettyFormat(Document doc) {
|
||||||
prettyFormat(doc, DEFAULT_IDENT);
|
prettyFormat(doc, DEFAULT_INDENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -145,13 +145,13 @@ public class XmlUtil {
|
||||||
* to be pretty printed, i.e. providing proper indentations for enclosed tags.
|
* to be pretty printed, i.e. providing proper indentations for enclosed tags.
|
||||||
*
|
*
|
||||||
* @param doc - DOM document to be pretty printed
|
* @param doc - DOM document to be pretty printed
|
||||||
* @param ident - custom indentation as a string of white spaces
|
* @param indent - custom indentation as a string of white spaces
|
||||||
*/
|
*/
|
||||||
public static void prettyFormat(Document doc, String ident) {
|
public static void prettyFormat(Document doc, String indent) {
|
||||||
doc.normalize();
|
doc.normalize();
|
||||||
Element documentElement = doc.getDocumentElement();
|
Element documentElement = doc.getDocumentElement();
|
||||||
if (documentElement != null) {
|
if (documentElement != null) {
|
||||||
prettyFormat(documentElement, "", ident); //$NON-NLS-1$
|
prettyFormat(documentElement, "", indent); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,17 +159,17 @@ public class XmlUtil {
|
||||||
* The method inserts end-of-line+indentation Text nodes where indentation is necessary.
|
* The method inserts end-of-line+indentation Text nodes where indentation is necessary.
|
||||||
*
|
*
|
||||||
* @param node - node to be pretty formatted
|
* @param node - node to be pretty formatted
|
||||||
* @param identLevel - initial indentation level of the node
|
* @param indentLevel - initial indentation level of the node
|
||||||
* @param ident - additional indentation inside the node
|
* @param indent - additional indentation inside the node
|
||||||
*/
|
*/
|
||||||
private static void prettyFormat(Node node, String identLevel, String ident) {
|
private static void prettyFormat(Node node, String indentLevel, String indent) {
|
||||||
NodeList nodelist = node.getChildNodes();
|
NodeList nodelist = node.getChildNodes();
|
||||||
int iStart = 0;
|
int iStart = 0;
|
||||||
Node item = nodelist.item(0);
|
Node item = nodelist.item(0);
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
short type = item.getNodeType();
|
short type = item.getNodeType();
|
||||||
if (type == Node.ELEMENT_NODE || type == Node.COMMENT_NODE) {
|
if (type == Node.ELEMENT_NODE || type == Node.COMMENT_NODE) {
|
||||||
Node newChild = node.getOwnerDocument().createTextNode(EOL_XML + identLevel + ident);
|
Node newChild = node.getOwnerDocument().createTextNode(EOL_XML + indentLevel + indent);
|
||||||
node.insertBefore(newChild, item);
|
node.insertBefore(newChild, item);
|
||||||
iStart = 1;
|
iStart = 1;
|
||||||
}
|
}
|
||||||
|
@ -180,25 +180,25 @@ public class XmlUtil {
|
||||||
short type = item.getNodeType();
|
short type = item.getNodeType();
|
||||||
if (type == Node.TEXT_NODE && item.getNodeValue().trim().length() == 0) {
|
if (type == Node.TEXT_NODE && item.getNodeValue().trim().length() == 0) {
|
||||||
if (i + 1 < nodelist.getLength()) {
|
if (i + 1 < nodelist.getLength()) {
|
||||||
item.setNodeValue(EOL_XML + identLevel + ident);
|
item.setNodeValue(EOL_XML + indentLevel + indent);
|
||||||
} else {
|
} else {
|
||||||
item.setNodeValue(EOL_XML + identLevel);
|
item.setNodeValue(EOL_XML + indentLevel);
|
||||||
}
|
}
|
||||||
} else if (type == Node.ELEMENT_NODE) {
|
} else if (type == Node.ELEMENT_NODE) {
|
||||||
prettyFormat(item, identLevel + ident, ident);
|
prettyFormat(item, indentLevel + indent, indent);
|
||||||
if (i + 1 < nodelist.getLength()) {
|
if (i + 1 < nodelist.getLength()) {
|
||||||
Node nextItem = nodelist.item(i + 1);
|
Node nextItem = nodelist.item(i + 1);
|
||||||
if (nextItem != null) {
|
if (nextItem != null) {
|
||||||
short nextType = nextItem.getNodeType();
|
short nextType = nextItem.getNodeType();
|
||||||
if (nextType == Node.ELEMENT_NODE || nextType == Node.COMMENT_NODE) {
|
if (nextType == Node.ELEMENT_NODE || nextType == Node.COMMENT_NODE) {
|
||||||
Node newChild = node.getOwnerDocument().createTextNode(EOL_XML + identLevel + ident);
|
Node newChild = node.getOwnerDocument().createTextNode(EOL_XML + indentLevel + indent);
|
||||||
node.insertBefore(newChild, nextItem);
|
node.insertBefore(newChild, nextItem);
|
||||||
i++;
|
i++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Node newChild = node.getOwnerDocument().createTextNode(EOL_XML + identLevel);
|
Node newChild = node.getOwnerDocument().createTextNode(EOL_XML + indentLevel);
|
||||||
node.appendChild(newChild);
|
node.appendChild(newChild);
|
||||||
i++;
|
i++;
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Add table
Reference in a new issue