Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2017-06-13 04:53:41 -0400
committerLars Vogel2017-06-16 03:29:36 -0400
commit26fe44a0d49942d92974f2052d40320c970a0a1b (patch)
treec907c8a8e7e2b69404e9666c41a164b1c0e7779c
parent18337c6c89e03d68945861964a5f50e7b13bafea (diff)
downloadeclipse.platform.text-26fe44a0d49942d92974f2052d40320c970a0a1b.tar.gz
eclipse.platform.text-26fe44a0d49942d92974f2052d40320c970a0a1b.tar.xz
eclipse.platform.text-26fe44a0d49942d92974f2052d40320c970a0a1b.zip
Bug 518340 - Replace StringBuffer with StringBuilder in org.eclipse.search
Change-Id: I92e8a9bdb970362ce7e86d707519823552f360c8 Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
-rw-r--r--org.eclipse.search/new search/org/eclipse/search/ui/text/FileTextSearchScope.java2
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchHistoryDropDownAction.java2
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/core/text/FileCharSequenceProvider.java8
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/core/text/FileNamePatternSearchScope.java2
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/core/text/PatternConstructor.java14
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/CopyToClipboardAction.java2
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/OpenSearchDialogPageAction.java2
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultLabelProvider.java2
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileSearchQuery.java2
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchPage.java4
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/util/FileTypeEditor.java2
11 files changed, 21 insertions, 21 deletions
diff --git a/org.eclipse.search/new search/org/eclipse/search/ui/text/FileTextSearchScope.java b/org.eclipse.search/new search/org/eclipse/search/ui/text/FileTextSearchScope.java
index da2462f3d..870b5d5c0 100644
--- a/org.eclipse.search/new search/org/eclipse/search/ui/text/FileTextSearchScope.java
+++ b/org.eclipse.search/new search/org/eclipse/search/ui/text/FileTextSearchScope.java
@@ -190,7 +190,7 @@ public final class FileTextSearchScope extends TextSearchScope {
return BasicElementLabels.getFilePattern("*"); //$NON-NLS-1$
}
Arrays.sort(ext);
- StringBuffer buf= new StringBuffer();
+ StringBuilder buf= new StringBuilder();
for (int i= 0; i < ext.length; i++) {
if (i > 0) {
buf.append(", "); //$NON-NLS-1$
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchHistoryDropDownAction.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchHistoryDropDownAction.java
index 45924a447..b2acc9a03 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchHistoryDropDownAction.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchHistoryDropDownAction.java
@@ -48,7 +48,7 @@ class SearchHistoryDropDownAction extends Action implements IMenuCreator {
}
private String escapeAmp(String label) {
- StringBuffer buf= new StringBuffer();
+ StringBuilder buf= new StringBuilder();
for (int i= 0; i < label.length(); i++) {
char ch= label.charAt(i);
buf.append(ch);
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/core/text/FileCharSequenceProvider.java b/org.eclipse.search/search/org/eclipse/search/internal/core/text/FileCharSequenceProvider.java
index 120fa8399..892488212 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/core/text/FileCharSequenceProvider.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/core/text/FileCharSequenceProvider.java
@@ -187,11 +187,11 @@ public class FileCharSequenceProvider {
return fBuf[pos - fOffset];
}
- public StringBuffer append(StringBuffer buf, int start, int length) {
+ public StringBuilder append(StringBuilder buf, int start, int length) {
return buf.append(fBuf, start - fOffset, length);
}
- public StringBuffer appendAll(StringBuffer buf) {
+ public StringBuilder appendAll(StringBuilder buf) {
return buf.append(fBuf, 0, fLength);
}
@@ -427,7 +427,7 @@ public class FileCharSequenceProvider {
throw new IndexOutOfBoundsException("end must be smaller than length"); //$NON-NLS-1$
}
- StringBuffer res= new StringBuffer(length);
+ StringBuilder res= new StringBuilder(length);
Buffer buffer= getBuffer(pos);
while (pos < endPos && buffer != null) {
@@ -464,7 +464,7 @@ public class FileCharSequenceProvider {
@Override
public String toString() {
int len= fLength != null ? fLength.intValue() : 4000;
- StringBuffer res= new StringBuffer(len);
+ StringBuilder res= new StringBuilder(len);
try {
Buffer buffer= getBuffer(0);
while (buffer != null) {
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/core/text/FileNamePatternSearchScope.java b/org.eclipse.search/search/org/eclipse/search/internal/core/text/FileNamePatternSearchScope.java
index 14576e6ca..a93aa568d 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/core/text/FileNamePatternSearchScope.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/core/text/FileNamePatternSearchScope.java
@@ -143,7 +143,7 @@ public class FileNamePatternSearchScope extends TextSearchScope {
public String getFileNamePatternDescription() {
String[] ext= fFileNamePatterns.toArray(new String[fFileNamePatterns.size()]);
Arrays.sort(ext);
- StringBuffer buf= new StringBuffer();
+ StringBuilder buf= new StringBuilder();
for (int i= 0; i < ext.length; i++) {
if (i > 0) {
buf.append(", "); //$NON-NLS-1$
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/core/text/PatternConstructor.java b/org.eclipse.search/search/org/eclipse/search/internal/core/text/PatternConstructor.java
index fd102eaa2..8128bc15d 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/core/text/PatternConstructor.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/core/text/PatternConstructor.java
@@ -53,7 +53,7 @@ public class PatternConstructor {
Assert.isTrue(!isWholeWord, "isWholeWord unsupported together with isRegex"); //$NON-NLS-1$
} else {
int len= pattern.length();
- StringBuffer buffer= new StringBuffer(len + 10);
+ StringBuilder buffer= new StringBuilder(len + 10);
// don't add a word boundary if the search text does not start with
// a word char. (this works around a user input error).
if (isWholeWord && len > 0 && isWordChar(pattern.charAt(0))) {
@@ -82,7 +82,7 @@ public class PatternConstructor {
*/
private static String substituteLinebreak(String findString) throws PatternSyntaxException {
int length= findString.length();
- StringBuffer buf= new StringBuffer(length);
+ StringBuilder buf= new StringBuilder(length);
int inCharGroup= 0;
int inBraces= 0;
@@ -166,7 +166,7 @@ public class PatternConstructor {
* @throws PatternSyntaxException if "\R" is at an illegal position
*/
public static Pattern createPattern(String[] patterns, boolean isCaseSensitive) throws PatternSyntaxException {
- StringBuffer pattern= new StringBuffer();
+ StringBuilder pattern= new StringBuilder();
for (int i= 0; i < patterns.length; i++) {
if (i > 0) {
// note that this works only as we know that the operands of the
@@ -179,7 +179,7 @@ public class PatternConstructor {
}
- public static StringBuffer appendAsRegEx(boolean isStringMatcher, String pattern, StringBuffer buffer) {
+ public static StringBuilder appendAsRegEx(boolean isStringMatcher, String pattern, StringBuilder buffer) {
boolean isEscaped= false;
for (int i = 0; i < pattern.length(); i++) {
char c = pattern.charAt(i);
@@ -297,7 +297,7 @@ public class PatternConstructor {
private String interpretReplaceEscapes(String replaceText, String foundText) {
int length= replaceText.length();
boolean inEscape= false;
- StringBuffer buf= new StringBuffer(length);
+ StringBuilder buf= new StringBuilder(length);
/* every string we did not check looks mixed at first
* so initialize retain case mode with RC_MIXED
@@ -358,7 +358,7 @@ public class PatternConstructor {
* @return the new offset
* @since 3.4
*/
- private int interpretReplaceEscape(final char ch, int i, StringBuffer buf, String replaceText, String foundText) {
+ private int interpretReplaceEscape(final char ch, int i, StringBuilder buf, String replaceText, String foundText) {
int length= replaceText.length();
switch (ch) {
case 'r':
@@ -488,7 +488,7 @@ public class PatternConstructor {
* @param ch the character to process
* @since 3.4
*/
- private void interpretRetainCase(StringBuffer buf, char ch) {
+ private void interpretRetainCase(StringBuilder buf, char ch) {
if (fRetainCaseMode == RC_UPPER)
buf.append(String.valueOf(ch).toUpperCase());
else if (fRetainCaseMode == RC_LOWER)
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/CopyToClipboardAction.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/CopyToClipboardAction.java
index 31b56c327..08636156e 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/CopyToClipboardAction.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/CopyToClipboardAction.java
@@ -108,7 +108,7 @@ public class CopyToClipboardAction extends Action {
IBaseLabelProvider labelProvider= fViewer.getLabelProvider();
String lineDelim= System.getProperty("line.separator"); //$NON-NLS-1$
- StringBuffer buf= new StringBuffer();
+ StringBuilder buf= new StringBuilder();
Iterator<?> iter= getSelection();
while (iter.hasNext()) {
if (buf.length() > 0) {
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/OpenSearchDialogPageAction.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/OpenSearchDialogPageAction.java
index 068992c47..33ebb3c12 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/OpenSearchDialogPageAction.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/OpenSearchDialogPageAction.java
@@ -99,7 +99,7 @@ public class OpenSearchDialogPageAction implements IWorkbenchWindowPulldownDeleg
}
private void addToMenu(Menu localMenu, IAction action, int accelerator) {
- StringBuffer label= new StringBuffer();
+ StringBuilder label= new StringBuilder();
if (accelerator >= 0 && accelerator < 10) {
//add the numerical accelerator
label.append('&');
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultLabelProvider.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultLabelProvider.java
index 3b4dd7ea8..d8a08bbf8 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultLabelProvider.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultLabelProvider.java
@@ -37,7 +37,7 @@ class SearchResultLabelProvider extends LabelProvider {
@Override
public String getText(Object element) {
- StringBuffer buf= new StringBuffer(getLabelProvider().getText(element));
+ StringBuilder buf= new StringBuilder(getLabelProvider().getText(element));
int count= ((ISearchResultViewEntry)element).getMatchCount();
if (count > 1) {
buf.append(" ("); //$NON-NLS-1$
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileSearchQuery.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileSearchQuery.java
index 84d3e7d20..a42870ecd 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileSearchQuery.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileSearchQuery.java
@@ -174,7 +174,7 @@ public class FileSearchQuery implements ISearchQuery {
}
private static String getContents(TextSearchMatchAccess matchRequestor, int start, int end) {
- StringBuffer buf= new StringBuffer();
+ StringBuilder buf= new StringBuilder();
for (int i= start; i < end; i++) {
char ch= matchRequestor.getFileContentChar(i);
if (Character.isWhitespace(ch) || Character.isISOControl(ch)) {
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchPage.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchPage.java
index fd14647fe..4e7c49376 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchPage.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchPage.java
@@ -686,7 +686,7 @@ public class TextSearchPage extends DialogPage implements ISearchPage, IReplaceP
private String insertEscapeChars(String text) {
if (text == null || text.equals("")) //$NON-NLS-1$
return ""; //$NON-NLS-1$
- StringBuffer sbIn= new StringBuffer(text);
+ StringBuilder sbIn= new StringBuilder(text);
BufferedReader reader= new BufferedReader(new StringReader(text));
int lengthOfFirstLine= 0;
try {
@@ -694,7 +694,7 @@ public class TextSearchPage extends DialogPage implements ISearchPage, IReplaceP
} catch (IOException ex) {
return ""; //$NON-NLS-1$
}
- StringBuffer sbOut= new StringBuffer(lengthOfFirstLine + 5);
+ StringBuilder sbOut= new StringBuilder(lengthOfFirstLine + 5);
int i= 0;
while (i < lengthOfFirstLine) {
char ch= sbIn.charAt(i);
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/util/FileTypeEditor.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/util/FileTypeEditor.java
index f8cd8e892..6556c413b 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/util/FileTypeEditor.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/util/FileTypeEditor.java
@@ -114,7 +114,7 @@ public class FileTypeEditor extends SelectionAdapter implements DisposeListener
public static String typesToString(String[] types) {
Arrays.sort(types, FILE_TYPES_COMPARATOR);
- StringBuffer result= new StringBuffer();
+ StringBuilder result= new StringBuilder();
for (int i= 0; i < types.length; i++) {
if (i > 0) {
result.append(TYPE_DELIMITER);

Back to the top