Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/HTMLPrinter.java23
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/param/ListProblemPreference.java2
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/align/Alignment.java4
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElement.java88
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate2.java4
5 files changed, 105 insertions, 16 deletions
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/HTMLPrinter.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/HTMLPrinter.java
index 1b8067e038..7a39670d4d 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/HTMLPrinter.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/HTMLPrinter.java
@@ -31,7 +31,7 @@ public class HTMLPrinter {
if (current == -1)
return text;
- StringBuffer buffer= new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
while (current > -1) {
buffer.append(text.substring(previous, current));
buffer.append(s);
@@ -50,7 +50,7 @@ public class HTMLPrinter {
public static String read(Reader rd) {
- StringBuffer buffer= new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
char[] readBuffer= new char[2048];
try {
@@ -66,27 +66,27 @@ public class HTMLPrinter {
return null;
}
- public static void insertPageProlog(StringBuffer buffer, int position) {
+ public static void insertPageProlog(StringBuilder buffer, int position) {
buffer.insert(position, "<html><body text=\"#000000\" bgcolor=\"#FFFF88\"><font size=-1>"); //$NON-NLS-1$
}
- public static void addPageProlog(StringBuffer buffer) {
+ public static void addPageProlog(StringBuilder buffer) {
insertPageProlog(buffer, buffer.length());
}
- public static void addPageEpilog(StringBuffer buffer) {
+ public static void addPageEpilog(StringBuilder buffer) {
buffer.append("</font></body></html>"); //$NON-NLS-1$
}
- public static void startBulletList(StringBuffer buffer) {
+ public static void startBulletList(StringBuilder buffer) {
buffer.append("<ul>"); //$NON-NLS-1$
}
- public static void endBulletList(StringBuffer buffer) {
+ public static void endBulletList(StringBuilder buffer) {
buffer.append("</ul>"); //$NON-NLS-1$
}
- public static void addBullet(StringBuffer buffer, String bullet) {
+ public static void addBullet(StringBuilder buffer, String bullet) {
if (bullet != null) {
buffer.append("<li>"); //$NON-NLS-1$
buffer.append(bullet);
@@ -94,7 +94,7 @@ public class HTMLPrinter {
}
}
- public static void addSmallHeader(StringBuffer buffer, String header) {
+ public static void addSmallHeader(StringBuilder buffer, String header) {
if (header != null) {
buffer.append("<h5>"); //$NON-NLS-1$
buffer.append(header);
@@ -102,14 +102,15 @@ public class HTMLPrinter {
}
}
- public static void addParagraph(StringBuffer buffer, String paragraph) {
+ public static void addParagraph(StringBuilder buffer, String paragraph) {
if (paragraph != null) {
buffer.append("<p>"); //$NON-NLS-1$
buffer.append(paragraph);
}
}
- public static void addParagraph(StringBuffer buffer, Reader paragraphReader) {
+ public static void addParagraph(StringBuilder buffer,
+ Reader paragraphReader) {
if (paragraphReader != null)
addParagraph(buffer, read(paragraphReader));
}
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/param/ListProblemPreference.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/param/ListProblemPreference.java
index ad8da555f8..d52c315317 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/param/ListProblemPreference.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/param/ListProblemPreference.java
@@ -206,7 +206,7 @@ public class ListProblemPreference extends AbstractProblemPreference implements
@Override
public String exportValue() {
- StringBuffer buf = new StringBuffer("("); //$NON-NLS-1$
+ StringBuilder buf = new StringBuilder("("); //$NON-NLS-1$
for (Iterator<Object> iterator = list.iterator(); iterator.hasNext();) {
IProblemPreference d = (IProblemPreference) childDescriptor.clone();
d.setValue(iterator.next());
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/align/Alignment.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/align/Alignment.java
index add75e4ceb..42490255bb 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/align/Alignment.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/align/Alignment.java
@@ -463,13 +463,13 @@ public class Alignment {
}
}
- public void toFragmentsString(StringBuffer buffer) {
+ public void toFragmentsString(StringBuilder buffer) {
// default implementation
}
@Override
public String toString() {
- StringBuffer buffer = new StringBuffer(10);
+ StringBuilder buffer = new StringBuilder(10);
buffer
.append(getClass().getName())
.append(':')
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElement.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElement.java
index 2b5fa24e90..12baa493fa 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElement.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElement.java
@@ -225,6 +225,10 @@ public class CPElement {
}
}
+ /**
+ * @deprecated Use {@link #appendEncodedPath(IPath, StringBuilder)}
+ */
+ @Deprecated
public static StringBuffer appendEncodePath(IPath path, StringBuffer buf) {
if (path != null) {
String str = path.toString();
@@ -235,6 +239,10 @@ public class CPElement {
return buf.append(';');
}
+ /**
+ * @deprecated Use {@link #appendEncodedSettings(StringBuilder)}
+ */
+ @Deprecated
public StringBuffer appendEncodedSettings(StringBuffer buf) {
buf.append(fEntryKind).append(';');
appendEncodePath(fPath, buf).append(';');
@@ -305,6 +313,86 @@ public class CPElement {
return buf;
}
+ public static StringBuilder appendEncodedPath(IPath path, StringBuilder buf) {
+ if (path != null) {
+ String str = path.toString();
+ buf.append('[').append(str.length()).append(']').append(str);
+ } else {
+ buf.append('[').append(']');
+ }
+ return buf.append(';');
+ }
+
+ public StringBuilder appendEncodedSettings(StringBuilder buf) {
+ buf.append(fEntryKind).append(';');
+ appendEncodedPath(fPath, buf).append(';');
+ buf.append(Boolean.valueOf(fIsExported)).append(';');
+ switch (fEntryKind) {
+ case IPathEntry.CDT_OUTPUT:
+ case IPathEntry.CDT_SOURCE:
+ case IPathEntry.CDT_INCLUDE:
+ case IPathEntry.CDT_INCLUDE_FILE:
+ case IPathEntry.CDT_MACRO:
+ case IPathEntry.CDT_MACRO_FILE:
+ IPath[] exclusion = (IPath[])getAttribute(EXCLUSION);
+ buf.append('[').append(exclusion.length).append(']');
+ for (IPath element : exclusion) {
+ appendEncodedPath(element, buf);
+ }
+ switch (fEntryKind) {
+ case IPathEntry.CDT_INCLUDE:
+ IPath baseRef = (IPath)getAttribute(BASE_REF);
+ appendEncodedPath(baseRef, buf);
+ IPath base = (IPath)getAttribute(BASE);
+ appendEncodedPath(base, buf);
+ IPath include = (IPath)getAttribute(INCLUDE);
+ appendEncodedPath(include, buf);
+ break;
+ case IPathEntry.CDT_INCLUDE_FILE:
+ baseRef = (IPath)getAttribute(BASE_REF);
+ appendEncodedPath(baseRef, buf);
+ base = (IPath)getAttribute(BASE);
+ appendEncodedPath(base, buf);
+ IPath includeFile = (IPath)getAttribute(INCLUDE_FILE);
+ appendEncodedPath(includeFile, buf);
+ break;
+ case IPathEntry.CDT_MACRO:
+ baseRef = (IPath)getAttribute(BASE_REF);
+ appendEncodedPath(baseRef, buf);
+ base = (IPath)getAttribute(BASE);
+ appendEncodedPath(base, buf);
+ String symbol = (String)getAttribute(MACRO_NAME);
+ buf.append(symbol).append(';');
+ break;
+ case IPathEntry.CDT_MACRO_FILE:
+ baseRef = (IPath)getAttribute(BASE_REF);
+ appendEncodedPath(baseRef, buf);
+ base = (IPath)getAttribute(BASE);
+ appendEncodedPath(base, buf);
+ IPath macrosFile = (IPath)getAttribute(MACROS_FILE);
+ appendEncodedPath(macrosFile, buf);
+ break;
+ default:
+ break;
+ }
+ break;
+ case IPathEntry.CDT_LIBRARY:
+ IPath baseRef = (IPath)getAttribute(BASE_REF);
+ appendEncodedPath(baseRef, buf);
+ IPath base = (IPath)getAttribute(BASE);
+ appendEncodedPath(base, buf);
+ IPath sourceAttach = (IPath)getAttribute(SOURCEATTACHMENT);
+ appendEncodedPath(sourceAttach, buf);
+ IPath library = (IPath)getAttribute(LIBRARY);
+ appendEncodedPath(library, buf);
+ break;
+ default:
+ break;
+ }
+ buf.setLength(buf.length() - 1);
+ return buf;
+ }
+
/**
* Gets the path entry path.
*
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate2.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate2.java
index 342bde0b60..ffaed3ece3 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate2.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate2.java
@@ -399,7 +399,7 @@ public abstract class AbstractCLaunchDelegate2 extends LaunchConfigurationDelega
/** TODO: Temporarily duplicated from BuilderFactory. Remove when 313927 is addressed */
private static String encodeList(List<String> values) {
- StringBuffer str = new StringBuffer();
+ StringBuilder str = new StringBuilder();
Iterator<String> entries = values.iterator();
while (entries.hasNext()) {
String entry = entries.next();
@@ -411,7 +411,7 @@ public abstract class AbstractCLaunchDelegate2 extends LaunchConfigurationDelega
/** TODO: Temporarily duplicated from BuilderFactory. Remove when 313927 is addressed */
private static String escapeChars(String string, String escapeChars, char escapeChar) {
- StringBuffer str = new StringBuffer(string);
+ StringBuilder str = new StringBuilder(string);
for (int i = 0; i < str.length(); i++) {
if (escapeChars.indexOf(str.charAt(i)) != -1) {
str.insert(i, escapeChar);

Back to the top