Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/AbstractItem.java6
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/CleanupClass.java4
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/EmbedMetaData.java6
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/JNIGenerator.java12
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/JNIGeneratorAppUI.java6
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/MetaDataGenerator.java2
-rw-r--r--bundles/org.eclipse.swt.tools/Mac Generation/org/eclipse/swt/tools/internal/DOMWriter.java4
-rw-r--r--bundles/org.eclipse.swt.tools/Mac Generation/org/eclipse/swt/tools/internal/MacGenerator.java12
-rw-r--r--bundles/org.eclipse.swt.tools/src/org/eclipse/swt/tools/builders/Check64CompilationParticipant.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleTextAttributeEvent.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/BrowserFunction.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/WebBrowser.java12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/DefaultContent.java8
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyleRange.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java20
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextRenderer.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DropTargetEvent.java8
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/common/org/eclipse/swt/internal/Library.java8
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/TextStyle.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngChunk.java9
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngIhdrChunk.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngPlteChunk.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/FontData.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java10
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FileDialog.java16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Link.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java4
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/clipboard/ClipboardExample.java4
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/BrowserTab.java6
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/dnd/DNDExample.java10
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaLineStyler.java4
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaViewer.java2
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/FillLayoutTab.java4
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/FormLayoutTab.java6
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/GridLayoutTab.java6
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/RowLayoutTab.java6
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/StackLayoutTab.java6
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/Tab.java18
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/TextEditor.java4
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/text.txt14
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet133.java12
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet179.java6
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet196.java9
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet222.java4
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet307.java4
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet338.java4
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_Browser.java6
50 files changed, 175 insertions, 173 deletions
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/AbstractItem.java b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/AbstractItem.java
index 5c0c4435b1..181d347b4d 100644
--- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/AbstractItem.java
+++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/AbstractItem.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2015 IBM Corporation and others.
+ * Copyright (c) 2008, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -27,7 +27,7 @@ void checkParams() {
public String flatten() {
checkParams();
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
Set<String> set = params.keySet();
String[] keys = set.toArray(new String[set.size()]);
Arrays.sort(keys);
@@ -39,7 +39,7 @@ public String flatten() {
valueStr = (String)value;
} else if (value instanceof String[]) {
String[] values = (String[])value;
- StringBuffer valueBuffer = new StringBuffer();
+ StringBuilder valueBuffer = new StringBuilder();
for (int i = 0; i < values.length; i++) {
if (i != 0) valueBuffer.append(" ");
valueBuffer.append(values[i]);
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/CleanupClass.java b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/CleanupClass.java
index 793209fe65..45c7b00ea9 100644
--- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/CleanupClass.java
+++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/CleanupClass.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2015 IBM Corporation and others.
+ * Copyright (c) 2004, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -80,7 +80,7 @@ void loadFiles () {
String loadFile (File file) {
try (FileReader fr = new FileReader(file);
BufferedReader br = new BufferedReader(fr)){
- StringBuffer str = new StringBuffer();
+ StringBuilder str = new StringBuilder();
char[] buffer = new char[1024];
int read;
while ((read = br.read(buffer)) != -1) {
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/EmbedMetaData.java b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/EmbedMetaData.java
index b4b83ddfd3..1c457c13ef 100644
--- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/EmbedMetaData.java
+++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/EmbedMetaData.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2017 IBM Corporation and others.
+ * Copyright (c) 2008, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -35,7 +35,7 @@ public void generate(JNIClass clazz) {
List<Integer> keys = new ArrayList<>();
keys.addAll(set);
Collections.reverse(keys);
- StringBuffer buffer = new StringBuffer(source);
+ StringBuilder buffer = new StringBuilder(source);
for (Integer index : keys) {
String doc = inserts.get(index);
buffer.insert(index.intValue(), doc);
@@ -98,7 +98,7 @@ public void generate(JNIMethod method) {
String doc = "/** " + tags.get(0) + " */" + delimiter;
inserts.put(Integer.valueOf(((ASTMethod)method).start), doc);
} else {
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
buffer.append("/**");
buffer.append(delimiter);
for (String tag : tags) {
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/JNIGenerator.java b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/JNIGenerator.java
index ed06304974..110167a12d 100644
--- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/JNIGenerator.java
+++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/JNIGenerator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2017 IBM Corporation and others.
+ * Copyright (c) 2004, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -33,7 +33,7 @@ public JNIGenerator() {
public static String skipCopyrights(InputStream is) throws IOException {
int state = 0;
- StringBuffer copyrights = new StringBuffer();
+ StringBuilder copyrights = new StringBuilder();
while (state != 5) {
int c = is.read();
if (c == -1) return null;
@@ -105,7 +105,7 @@ public static String getDelimiter(String fileName) {
String fixDelimiter(String str) {
if (delimiter.equals("\n")) return str;
int index = 0, length = str.length();
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
while (index != -1) {
int start = index;
index = str.indexOf('\n', start);
@@ -128,7 +128,7 @@ static String getFunctionName(JNIMethod method, JNIType[] paramTypes) {
if ((method.getModifiers() & Modifier.NATIVE) == 0) return method.getName();
String function = toC(method.getName());
if (!method.isNativeUnique()) {
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
buffer.append(function);
buffer.append("__");
for (int i = 0; i < paramTypes.length; i++) {
@@ -143,7 +143,7 @@ static String getFunctionName(JNIMethod method, JNIType[] paramTypes) {
static String loadFile (String file) {
try (FileReader fr = new FileReader(file);
BufferedReader br = new BufferedReader(fr)){
- StringBuffer str = new StringBuffer();
+ StringBuilder str = new StringBuilder();
char[] buffer = new char[1024];
int read;
while ((read = br.read(buffer)) != -1) {
@@ -182,7 +182,7 @@ static String[] split(String str, String separator) {
static String toC(String str) {
int length = str.length();
- StringBuffer buffer = new StringBuffer(length * 2);
+ StringBuilder buffer = new StringBuilder(length * 2);
for (int i = 0; i < length; i++) {
char c = str.charAt(i);
switch (c) {
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/JNIGeneratorAppUI.java b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/JNIGeneratorAppUI.java
index 521c6563a9..7a0834b38b 100644
--- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/JNIGeneratorAppUI.java
+++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/JNIGeneratorAppUI.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2017 IBM Corporation and others.
+ * Copyright (c) 2004, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -914,7 +914,7 @@ String getClassString(JNIType type) {
String getFlagsString(String[] flags) {
if (flags.length == 0) return "";
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
for (int j = 0; j < flags.length; j++) {
String flag = flags[j];
if (buffer.length() != 0) buffer.append(", ");
@@ -925,7 +925,7 @@ String getFlagsString(String[] flags) {
String getMethodString(JNIMethod method) {
String pkgName = getPackageString();
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
buffer.append(method.getName());
buffer.append("(");
JNIParameter[] params = method.getParameters();
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/MetaDataGenerator.java b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/MetaDataGenerator.java
index 2243fd9c89..44f58a34d1 100644
--- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/MetaDataGenerator.java
+++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/MetaDataGenerator.java
@@ -64,7 +64,7 @@ public void generate(JNIMethod[] methods) {
}
public void generate(JNIMethod method) {
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
buffer.append(method.getDeclaringClass().getSimpleName());
buffer.append("_");
if (method.isNativeUnique()) {
diff --git a/bundles/org.eclipse.swt.tools/Mac Generation/org/eclipse/swt/tools/internal/DOMWriter.java b/bundles/org.eclipse.swt.tools/Mac Generation/org/eclipse/swt/tools/internal/DOMWriter.java
index d1460de16d..eafac70129 100644
--- a/bundles/org.eclipse.swt.tools/Mac Generation/org/eclipse/swt/tools/internal/DOMWriter.java
+++ b/bundles/org.eclipse.swt.tools/Mac Generation/org/eclipse/swt/tools/internal/DOMWriter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2017 IBM Corporation and others.
+ * Copyright (c) 2008, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -155,7 +155,7 @@ public class DOMWriter {
String normalize(String s) {
if (s == null) return "";
- StringBuffer str = new StringBuffer();
+ StringBuilder str = new StringBuilder();
for (int i = 0, length = s.length(); i < length; i++) {
char ch = s.charAt(i);
switch (ch) {
diff --git a/bundles/org.eclipse.swt.tools/Mac Generation/org/eclipse/swt/tools/internal/MacGenerator.java b/bundles/org.eclipse.swt.tools/Mac Generation/org/eclipse/swt/tools/internal/MacGenerator.java
index 273971ca3a..5a890ca792 100644
--- a/bundles/org.eclipse.swt.tools/Mac Generation/org/eclipse/swt/tools/internal/MacGenerator.java
+++ b/bundles/org.eclipse.swt.tools/Mac Generation/org/eclipse/swt/tools/internal/MacGenerator.java
@@ -231,7 +231,7 @@ void generateCSource() {
String fixDelimiter(String str) {
if (delimiter.equals("\n")) return str;
int index = 0, length = str.length();
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
while (index != -1) {
int start = index;
index = str.indexOf('\n', start);
@@ -789,7 +789,7 @@ void generateMainClass() {
String fileName = outputDir + mainClassName.replace('.', '/') + ".java";
try (FileInputStream is = new FileInputStream(fileName);
InputStreamReader input = new InputStreamReader(new BufferedInputStream(is))){
- StringBuffer str = new StringBuffer();
+ StringBuilder str = new StringBuilder();
char[] buffer = new char[4096];
int read;
while ((read = input.read(buffer)) != -1) {
@@ -863,7 +863,7 @@ void generateSelectorEnum() {
String fileName = outputDir + selectorEnumName.replace('.', '/') + ".java";
try (FileInputStream is = new FileInputStream(fileName);
InputStreamReader input = new InputStreamReader(new BufferedInputStream(is))){
- StringBuffer str = new StringBuffer();
+ StringBuilder str = new StringBuilder();
char[] buffer = new char[4096];
int read;
while ((read = input.read(buffer)) != -1) {
@@ -1065,11 +1065,11 @@ int indexOfNode(Node node) {
}
String getKey (Node node) {
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
while (node != null) {
if (buffer.length() > 0) buffer.append("_");
String name = node.getNodeName();
- StringBuffer key = new StringBuffer(name);
+ StringBuilder key = new StringBuilder(name);
if ("arg".equals(name)) {
key.append("-");
key.append(indexOfNode(node));
@@ -1480,7 +1480,7 @@ void generateStructNatives() {
String buildSend(Node method, boolean tags, boolean only64, boolean superCall) {
Node returnNode = getReturnNode(method.getChildNodes());
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
buffer.append("public static final native ");
if (returnNode != null && isStruct(returnNode)) {
buffer.append("void ");
diff --git a/bundles/org.eclipse.swt.tools/src/org/eclipse/swt/tools/builders/Check64CompilationParticipant.java b/bundles/org.eclipse.swt.tools/src/org/eclipse/swt/tools/builders/Check64CompilationParticipant.java
index 4634d948f7..9e15957e95 100644
--- a/bundles/org.eclipse.swt.tools/src/org/eclipse/swt/tools/builders/Check64CompilationParticipant.java
+++ b/bundles/org.eclipse.swt.tools/src/org/eclipse/swt/tools/builders/Check64CompilationParticipant.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2017 IBM Corporation and others.
+ * Copyright (c) 2008, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -46,7 +46,7 @@ static String loadFile (String file) {
if (file == null) return null;
try (FileReader fr = new FileReader(file);
BufferedReader br = new BufferedReader(fr)) {
- StringBuffer str = new StringBuffer();
+ StringBuilder str = new StringBuilder();
char[] buffer = new char[1024];
int read;
while ((read = br.read(buffer)) != -1) {
@@ -61,7 +61,7 @@ static String loadFile (String file) {
void build(IJavaProject project, String root) throws CoreException {
try {
- StringBuffer sourcePath = new StringBuffer(), cp = new StringBuffer();
+ StringBuilder sourcePath = new StringBuilder(), cp = new StringBuilder();
IClasspathEntry[] entries = project.getResolvedClasspath(true);
for (int i = 0; i < entries.length; i++) {
IClasspathEntry entry = entries[i];
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleTextAttributeEvent.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleTextAttributeEvent.java
index bae41ae482..4b6a51c216 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleTextAttributeEvent.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleTextAttributeEvent.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2017 IBM Corporation and others.
+ * Copyright (c) 2009, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -101,7 +101,7 @@ public String toString () {
String toAttributeString(String [] attributes) {
if (attributes == null || attributes.length == 0) return "" + attributes; //$NON-NLS-1$
- StringBuffer attributeString = new StringBuffer();
+ StringBuilder attributeString = new StringBuilder();
for (int i = 0; i < attributes.length; i++) {
attributeString.append(attributes[i]);
attributeString.append((i % 2 == 0) ? ":" : ";"); //$NON-NLS-1$ //$NON-NLS-2$
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/BrowserFunction.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/BrowserFunction.java
index 7b3127aa4b..f55596b1f1 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/BrowserFunction.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/BrowserFunction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2012 IBM Corporation and others.
+ * Copyright (c) 2008, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,7 +10,7 @@
*******************************************************************************/
package org.eclipse.swt.browser;
-import java.util.Random;
+import java.util.*;
import org.eclipse.swt.*;
@@ -139,7 +139,7 @@ BrowserFunction (Browser browser, String name, boolean top, String[] frameNames,
Random random = new Random ();
byte[] bytes = new byte[16];
random.nextBytes (bytes);
- StringBuffer buffer = new StringBuffer ();
+ StringBuilder buffer = new StringBuilder ();
for (int i = 0; i < bytes.length; i++) {
buffer.append (Integer.toHexString (bytes[i] & 0xff));
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/WebBrowser.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/WebBrowser.java
index 0ebbd7fcb6..5a61035a19 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/WebBrowser.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/WebBrowser.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2017 IBM Corporation and others.
+ * Copyright (c) 2003, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -320,7 +320,7 @@ public void createFunction (BrowserFunction function) {
function.index = getNextFunctionIndex ();
registerFunction (function);
- StringBuffer functionBuffer = new StringBuffer (function.name);
+ StringBuilder functionBuffer = new StringBuilder (function.name);
functionBuffer.append (" = function "); //$NON-NLS-1$
functionBuffer.append (function.name);
functionBuffer.append ("() {var result = callJava("); //$NON-NLS-1$
@@ -335,7 +335,7 @@ public void createFunction (BrowserFunction function) {
String javaCallDeclaration = getJavaCallDeclaration();
- StringBuffer buffer = new StringBuffer (); //$NON-NLS-1$
+ StringBuilder buffer = new StringBuilder (); //$NON-NLS-1$
buffer.append (javaCallDeclaration); //$NON-NLS-1$
if (function.top) {
buffer.append (functionBuffer.toString ());
@@ -382,7 +382,7 @@ void deregisterFunction (BrowserFunction function) {
public void destroyFunction (BrowserFunction function) {
String deleteString = getDeleteFunctionString (function.name);
- StringBuffer buffer = new StringBuffer ("for (var i = 0; i < frames.length; i++) {try {frames[i].eval(\""); //$NON-NLS-1$
+ StringBuilder buffer = new StringBuilder ("for (var i = 0; i < frames.length; i++) {try {frames[i].eval(\""); //$NON-NLS-1$
buffer.append (deleteString);
buffer.append ("\");} catch (e) {}}"); //$NON-NLS-1$
nonBlockingExecute (buffer.toString ());
@@ -413,7 +413,7 @@ public Object evaluate (String script) throws SWTException {
registerFunction (function);
String functionName = EXECUTE_ID + index;
- StringBuffer buffer = new StringBuffer ("window."); // $NON-NLS-1$
+ StringBuilder buffer = new StringBuilder ("window."); // $NON-NLS-1$
buffer.append (functionName);
buffer.append (" = function "); // $NON-NLS-1$
buffer.append (functionName);
@@ -422,7 +422,7 @@ public Object evaluate (String script) throws SWTException {
buffer.append ("\n};"); // $NON-NLS-1$
nonBlockingExecute (buffer.toString ());
- buffer = new StringBuffer ("if (window."); // $NON-NLS-1$
+ buffer = new StringBuilder ("if (window."); // $NON-NLS-1$
buffer.append (functionName);
buffer.append (" == undefined) {window.external.callJava("); // $NON-NLS-1$
buffer.append (index);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/DefaultContent.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/DefaultContent.java
index 619c32c964..2823153473 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/DefaultContent.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/DefaultContent.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -492,7 +492,7 @@ public String getLine(int index) {
return new String(textStore, start, length);
} else {
// gap is in the specified range, strip out the gap
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
int gapLength = gapEnd - gapStart;
buf.append(textStore, start, gapStart - start);
buf.append(textStore, gapEnd, length - gapLength - (gapStart - start));
@@ -531,7 +531,7 @@ String getFullLine(int index) {
return new String(textStore, start, length);
} else {
// gap is in the specified range, strip out the gap
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
int gapLength = gapEnd - gapStart;
buffer.append(textStore, start, gapStart - start);
buffer.append(textStore, gapEnd, length - gapLength - (gapStart - start));
@@ -721,7 +721,7 @@ public String getTextRange(int start, int length) {
int gapLength= gapEnd - gapStart;
return new String(textStore, start + gapLength , length);
}
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
buf.append(textStore, start, gapStart - start);
buf.append(textStore, gapEnd, end - gapStart);
return buf.toString();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyleRange.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyleRange.java
index 3a88583873..eb32700c60 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyleRange.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyleRange.java
@@ -187,7 +187,7 @@ public Object clone() {
*/
@Override
public String toString() {
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
buffer.append("StyleRange {");
buffer.append(start);
buffer.append(", ");
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java
index edfd2f04a3..19d721fcc8 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -477,7 +477,7 @@ public class StyledText extends Canvas {
}
}
} else {
- StringBuffer buffer = new StringBuffer("0");
+ StringBuilder buffer = new StringBuilder("0");
while ((count /= 10) > 0) buffer.append("0");
printLayout.setText(buffer.toString());
numberingWidth = printLayout.getBounds().width;
@@ -585,7 +585,7 @@ public class StyledText extends Canvas {
int pageIndex = segment.indexOf(StyledTextPrintOptions.PAGE_TAG);
if (pageIndex != -1) {
int pageTagLength = StyledTextPrintOptions.PAGE_TAG.length();
- StringBuffer buffer = new StringBuffer(segment.substring (0, pageIndex));
+ StringBuilder buffer = new StringBuilder(segment.substring (0, pageIndex));
buffer.append (page);
buffer.append (segment.substring(pageIndex + pageTagLength));
segment = buffer.toString();
@@ -823,7 +823,7 @@ public class StyledText extends Canvas {
* Writes the RTF header including font table and color table.
*/
void writeHeader() {
- StringBuffer header = new StringBuffer();
+ StringBuilder header = new StringBuilder();
FontData fontData = getFont().getFontData()[0];
header.append("{\\rtf1\\ansi");
// specify code page, necessary for copy to work in bidi
@@ -1062,7 +1062,7 @@ public class StyledText extends Canvas {
* </p>
*/
class TextWriter {
- private StringBuffer buffer;
+ private StringBuilder buffer;
private int startOffset; // offset of first character that will be written
private int endOffset; // offset of last character that will be written.
// 0 based from the beginning of the widget text.
@@ -1076,7 +1076,7 @@ public class StyledText extends Canvas {
* @param length length of content to write
*/
public TextWriter(int start, int length) {
- buffer = new StringBuffer(length);
+ buffer = new StringBuilder(length);
startOffset = start;
endOffset = start + length;
}
@@ -1949,7 +1949,7 @@ String getModelDelimitedText(String text) {
int crIndex = 0;
int lfIndex = 0;
int i = 0;
- StringBuffer convertedText = new StringBuffer(length);
+ StringBuilder convertedText = new StringBuilder(length);
String delimiter = getLineDelimiter();
while (i < length) {
if (crIndex != -1) {
@@ -3628,7 +3628,7 @@ String getBlockSelectionText(String delimiter) {
int lastLine = rect.height;
int left = rect.x;
int right = rect.width;
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
for (int lineIndex = firstLine; lineIndex <= lastLine; lineIndex++) {
int start = getOffsetAtPoint(left, 0, lineIndex, null);
int end = getOffsetAtPoint(right, 0, lineIndex, null);
@@ -5642,7 +5642,7 @@ int insertBlockSelectionText(String text, boolean fillWithSpaces) {
int length = line.length();
if (length < maxLength) {
int numSpaces = maxLength - length;
- StringBuffer buffer = new StringBuffer(length + numSpaces);
+ StringBuilder buffer = new StringBuilder(length + numSpaces);
buffer.append(line);
for (int j = 0; j < numSpaces; j++) buffer.append(' ');
lines[i] = buffer.toString();
@@ -8286,7 +8286,7 @@ void sendSelectionEvent() {
}
int sendTextEvent(int left, int right, int lineIndex, String text, boolean fillWithSpaces) {
int lineWidth = 0, start, end;
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
if (lineIndex < content.getLineCount()) {
int[] trailing = new int[1];
start = getOffsetAtPoint(left, getLinePixel(lineIndex), trailing, true);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextRenderer.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextRenderer.java
index df4742f591..8b45d2b5e4 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextRenderer.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextRenderer.java
@@ -1164,7 +1164,7 @@ void setFont(Font font, int tabs) {
layout.dispose();
layout = new TextLayout(device);
layout.setFont(regularFont);
- StringBuffer tabBuffer = new StringBuffer(tabs);
+ StringBuilder tabBuffer = new StringBuilder(tabs);
for (int i = 0; i < tabs; i++) {
tabBuffer.append(' ');
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DropTargetEvent.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DropTargetEvent.java
index 6f22d7a0b7..3f79e85fd0 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DropTargetEvent.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DropTargetEvent.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,8 +10,8 @@
*******************************************************************************/
package org.eclipse.swt.dnd;
-import org.eclipse.swt.events.TypedEvent;
-import org.eclipse.swt.widgets.Widget;
+import org.eclipse.swt.events.*;
+import org.eclipse.swt.widgets.*;
/**
* The DropTargetEvent contains the event information passed in the methods of the DropTargetListener.
@@ -125,7 +125,7 @@ void updateEvent(DNDEvent e) {
@Override
public String toString() {
String string = super.toString ();
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append(string.substring (0, string.length() - 1)); // remove trailing '}'
sb.append(" x="); sb.append(x);
sb.append(" y="); sb.append(y);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/common/org/eclipse/swt/internal/Library.java b/bundles/org.eclipse.swt/Eclipse SWT PI/common/org/eclipse/swt/internal/Library.java
index 23d58bc61e..44dab97797 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/common/org/eclipse/swt/internal/Library.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/common/org/eclipse/swt/internal/Library.java
@@ -143,7 +143,7 @@ public static int SWT_VERSION (int major, int minor) {
* @param mappedName file to be searched in jar.
* @return true upon success, failure if something went wrong.
*/
-static boolean extract (String extractToFilePath, String mappedName, StringBuffer message) {
+static boolean extract (String extractToFilePath, String mappedName, StringBuilder message) {
FileOutputStream os = null;
InputStream is = null;
File file = new File(extractToFilePath);
@@ -209,7 +209,7 @@ static boolean isLoadable () {
return false;
}
-static boolean load (String libName, StringBuffer message) {
+static boolean load (String libName, StringBuilder message) {
try {
if (libName.indexOf (SEPARATOR) != -1) {
System.load (libName);
@@ -277,7 +277,7 @@ public static void loadLibrary (String name, boolean mapName) {
libName1 = libName2 = mappedName1 = mappedName2 = name;
}
- StringBuffer message = new StringBuffer();
+ StringBuilder message = new StringBuilder();
/* Try loading library from swt library path */
String path = System.getProperty (SWT_LIB_PATH); //$NON-NLS-1$
@@ -447,7 +447,7 @@ public static File findResource(String subDir, String resourceName, boolean mapR
tempDir.mkdirs ();
}
- StringBuffer message = new StringBuffer("");
+ StringBuilder message = new StringBuilder("");
if (extract(file.getPath(), maybeSubDirPath + finalResourceName, message)) {
if (file.exists()) {
return file;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java
index 10b09fd306..7c6a777ff5 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2017 IBM Corporation and others.
+ * Copyright (c) 2010, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -1297,16 +1297,16 @@ void addEventHandlers (long /*int*/ web_view, boolean top) {
if (WEBKIT1) { // add HandleWebKitEvent key/mouse handlers
/* install the JS call-out to the registered BrowserFunction */
- StringBuffer buffer = new StringBuffer ("window.SWTkeyhandler = function SWTkeyhandler(e) {"); //$NON-NLS-1$
+ StringBuilder buffer = new StringBuilder ("window.SWTkeyhandler = function SWTkeyhandler(e) {"); //$NON-NLS-1$
buffer.append ("try {e.returnValue = HandleWebKitEvent(e.type, e.keyCode, e.charCode, e.altKey, e.ctrlKey, e.shiftKey, e.metaKey);} catch (e) {}};"); //$NON-NLS-1$
nonBlockingExecute (buffer.toString ());
- buffer = new StringBuffer ("window.SWTmousehandler = function SWTmousehandler(e) {"); //$NON-NLS-1$
+ buffer = new StringBuilder ("window.SWTmousehandler = function SWTmousehandler(e) {"); //$NON-NLS-1$
buffer.append ("try {e.returnValue = HandleWebKitEvent(e.type, e.screenX, e.screenY, e.detail, e.button, e.altKey, e.ctrlKey, e.shiftKey, e.metaKey, e.relatedTarget != null);} catch (e) {}};"); //$NON-NLS-1$
nonBlockingExecute (buffer.toString ());
if (top) {
/* DOM API is not available, so add listener to top-level document */
- buffer = new StringBuffer ("document.addEventListener('keydown', SWTkeyhandler, true);"); //$NON-NLS-1$
+ buffer = new StringBuilder ("document.addEventListener('keydown', SWTkeyhandler, true);"); //$NON-NLS-1$
buffer.append ("document.addEventListener('keypress', SWTkeyhandler, true);"); //$NON-NLS-1$
buffer.append ("document.addEventListener('keyup', SWTkeyhandler, true);"); //$NON-NLS-1$
buffer.append ("document.addEventListener('mousedown', SWTmousehandler, true);"); //$NON-NLS-1$
@@ -1328,7 +1328,7 @@ void addEventHandlers (long /*int*/ web_view, boolean top) {
}
/* add JS event listener in frames */
- buffer = new StringBuffer ("for (var i = 0; i < frames.length; i++) {"); //$NON-NLS-1$
+ buffer = new StringBuilder ("for (var i = 0; i < frames.length; i++) {"); //$NON-NLS-1$
buffer.append ("frames[i].document.addEventListener('keydown', window.SWTkeyhandler, true);"); //$NON-NLS-1$
buffer.append ("frames[i].document.addEventListener('keypress', window.SWTkeyhandler, true);"); //$NON-NLS-1$
buffer.append ("frames[i].document.addEventListener('keyup', window.SWTkeyhandler, true);"); //$NON-NLS-1$
@@ -1367,7 +1367,7 @@ boolean close (boolean showPrompters) {
String message1 = Compatibility.getMessage("SWT_OnBeforeUnload_Message1"); // $NON-NLS-1$
String message2 = Compatibility.getMessage("SWT_OnBeforeUnload_Message2"); // $NON-NLS-1$
String functionName = EXECUTE_ID + "CLOSE"; // $NON-NLS-1$
- StringBuffer buffer = new StringBuffer ("function "); // $NON-NLS-1$
+ StringBuilder buffer = new StringBuilder ("function "); // $NON-NLS-1$
buffer.append (functionName);
buffer.append ("(win) {\n"); // $NON-NLS-1$
buffer.append ("var fn = win.onbeforeunload; if (fn != null) {try {var str = fn(); "); // $NON-NLS-1$
@@ -2666,7 +2666,7 @@ public boolean setUrl (String url, String postData, String[] headers) {
out.write(postData.getBytes());
}
- StringBuffer response = new StringBuffer();
+ StringBuilder response = new StringBuilder();
try (BufferedReader buff = new BufferedReader(new InputStreamReader(conn.getInputStream()))) {
char [] cbuff = new char[4096];
while (buff.read(cbuff, 0, cbuff.length) > 0) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/TextStyle.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/TextStyle.java
index 33a43b57b1..dc9a1325e2 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/TextStyle.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/TextStyle.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -328,7 +328,7 @@ boolean isAdherentStrikeout(TextStyle style) {
*/
@Override
public String toString () {
- StringBuffer buffer = new StringBuffer("TextStyle {"); //$NON-NLS-1$
+ StringBuilder buffer = new StringBuilder("TextStyle {"); //$NON-NLS-1$
int startLength = buffer.length();
if (font != null) {
if (buffer.length() > startLength) buffer.append(", "); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngChunk.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngChunk.java
index d8d29cb067..f8e92596e0 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngChunk.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngChunk.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,9 +11,10 @@
package org.eclipse.swt.internal.image;
-import org.eclipse.swt.*;
import java.io.*;
+import org.eclipse.swt.*;
+
class PngChunk extends Object {
byte[] reference;
@@ -351,7 +352,7 @@ void validate(PngFileReadState readState, PngIhdrChunk headerChunk) {
* Provided so that subclasses can override and add
* data to the toString() call.
*/
-void contributeToString(StringBuffer buffer) {}
+void contributeToString(StringBuilder buffer) {}
/**
* Returns a string containing a concise, human-readable
@@ -361,7 +362,7 @@ void contributeToString(StringBuffer buffer) {}
*/
@Override
public String toString() {
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
buffer.append("{");
buffer.append("\n\tLength: ");
buffer.append(getLength());
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngIhdrChunk.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngIhdrChunk.java
index 0d698c88d5..d4cb015346 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngIhdrChunk.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngIhdrChunk.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -297,7 +297,7 @@ String getInterlaceMethodString() {
}
@Override
-void contributeToString(StringBuffer buffer) {
+void contributeToString(StringBuilder buffer) {
buffer.append("\n\tWidth: ");
buffer.append(width);
buffer.append("\n\tHeight: ");
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngPlteChunk.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngPlteChunk.java
index 597c4540ea..e9e56b65e8 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngPlteChunk.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngPlteChunk.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -118,7 +118,7 @@ void validate(PngFileReadState readState, PngIhdrChunk headerChunk) {
}
@Override
-void contributeToString(StringBuffer buffer) {
+void contributeToString(StringBuilder buffer) {
buffer.append("\n\tPalette size:");
buffer.append(paletteSize);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/FontData.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/FontData.java
index 49cf817605..930cba3b07 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/FontData.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/FontData.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -258,7 +258,7 @@ public int getHeight() {
* @since 3.0
*/
public String getLocale () {
- StringBuffer buffer = new StringBuffer ();
+ StringBuilder buffer = new StringBuilder ();
char sep = '_';
if (lang != null) {
buffer.append (lang);
@@ -442,7 +442,7 @@ public void setStyle(int style) {
*/
@Override
public String toString() {
- StringBuffer buffer = new StringBuffer(128);
+ StringBuilder buffer = new StringBuilder(128);
buffer.append("1|");
buffer.append(getName());
buffer.append("|");
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java
index e4baa0fc7d..ac7a452681 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -842,7 +842,7 @@ public int getSeconds () {
*/
String getSpokenText () {
// TODO: needs more work for locale
- StringBuffer result = new StringBuffer ();
+ StringBuilder result = new StringBuilder ();
if (isTime ()) {
int h = calendar.get (Calendar.HOUR); if (h == 0) h = 12;
result.append (h);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java
index 8cc2a3e252..5e809650aa 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -146,13 +146,13 @@ String openChooserDialog () {
OS.g_list_free (pixbufs);
}
if (filterPath != null && filterPath.length () > 0) {
- StringBuffer stringBuffer = new StringBuffer ();
+ StringBuilder stringBuilder = new StringBuilder ();
/* filename must be a full path */
if (!filterPath.startsWith (SEPARATOR)) {
- stringBuffer.append (SEPARATOR);
+ stringBuilder.append (SEPARATOR);
}
- stringBuffer.append (filterPath);
- byte [] buffer = Converter.wcsToMbcs (stringBuffer.toString (), true);
+ stringBuilder.append (filterPath);
+ byte [] buffer = Converter.wcsToMbcs (stringBuilder.toString (), true);
/*
* in GTK version 2.10, gtk_file_chooser_set_current_folder requires path
* to be true canonical path. So using realpath to convert the path to
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FileDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FileDialog.java
index ed86a6b733..ce22f78270 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FileDialog.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FileDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -410,7 +410,7 @@ void presetChooserDialog () {
}
}
if (fileName.length () > 0) {
- StringBuffer filenameWithExt = new StringBuffer();
+ StringBuilder filenameWithExt = new StringBuilder();
filenameWithExt.append (fileName);
if ((fileName.lastIndexOf (FILE_EXTENSION_SEPARATOR) == -1) &&
(filterExtensions.length != 0)) { // Filename doesn't contain the extension and user has provided filter extensions
@@ -439,19 +439,19 @@ void presetChooserDialog () {
OS.gtk_file_chooser_set_current_name (handle, buffer);
}
} else {
- StringBuffer stringBuffer = new StringBuffer();
+ StringBuilder stringBuilder = new StringBuilder();
if (filterPath.length () > 0) {
if (!uriMode) {
/* filename must be a full path */
- stringBuffer.append(SEPARATOR);
+ stringBuilder.append(SEPARATOR);
}
- stringBuffer.append(filterPath);
- stringBuffer.append(SEPARATOR);
+ stringBuilder.append(filterPath);
+ stringBuilder.append(SEPARATOR);
}
if (fileName.length () > 0) {
- stringBuffer.append(fileName);
+ stringBuilder.append(fileName);
}
- byte [] buffer = Converter.wcsToMbcs (stringBuffer.toString(), true);
+ byte [] buffer = Converter.wcsToMbcs (stringBuilder.toString(), true);
if (uriMode) {
OS.gtk_file_chooser_set_uri (handle, buffer);
} else {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Link.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Link.java
index 3fe8a6b6b1..54cb41c911 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Link.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Link.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -569,7 +569,7 @@ String parse (String string) {
offsets = new Point [length / 4];
ids = new String [length / 4];
mnemonics = new int [length / 4 + 1];
- StringBuffer result = new StringBuffer ();
+ StringBuilder result = new StringBuilder ();
char [] buffer = new char [length];
string.getChars (0, string.length (), buffer, 0);
int index = 0, state = 0, linkIndex = 0;
@@ -695,7 +695,7 @@ String parse (String string) {
return result.toString ();
}
-int parseMnemonics (char[] buffer, int start, int end, StringBuffer result) {
+int parseMnemonics (char[] buffer, int start, int end, StringBuilder result) {
int mnemonic = -1, index = start;
while (index < end) {
if (buffer [index] == '&') {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java
index 00e2c7d1b0..9853b05330 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -217,7 +217,7 @@ Point computeSizeInPixels (int wHint, int hHint, boolean changed) {
for (int i = 0; i < digits; i++) upper *= 10;
String string = String.valueOf ((int) upper);
if (digits > 0) {
- StringBuffer buffer = new StringBuffer ();
+ StringBuilder buffer = new StringBuilder ();
buffer.append (string);
buffer.append (getDecimalSeparator ());
int count = digits - string.length ();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java
index 39e83a3505..b88cc109ec 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -815,7 +815,7 @@ public void setVisible (boolean visible) {
OS.gtk_widget_show (handle);
} else {
long /*int*/ vboxHandle = parent.vboxHandle;
- StringBuffer string = new StringBuffer (text);
+ StringBuilder string = new StringBuilder (text);
if (text.length () > 0) string.append ("\n\n");
string.append (message);
byte [] buffer = Converter.wcsToMbcs (string.toString(), true);
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/clipboard/ClipboardExample.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/clipboard/ClipboardExample.java
index a586739848..b3d29ba405 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/clipboard/ClipboardExample.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/clipboard/ClipboardExample.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -217,7 +217,7 @@ void createRTFTransfer(Composite copyParent, Composite pasteParent){
String textData = copyRtfText.getText();
if (textData.length() > 0) {
status.setText("");
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
buffer.append("{\\rtf1\\ansi\\uc1{\\colortbl;\\red255\\green0\\blue0;}\\uc1\\b\\i ");
for (int i = 0; i < textData.length(); i++) {
char ch = textData.charAt(i);
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/BrowserTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/BrowserTab.java
index 48819b9a4f..49d01d4ec2 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/BrowserTab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/BrowserTab.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -111,7 +111,7 @@ class BrowserTab extends Tab {
} else if (lastText != null) {
browser.setText(lastText);
} else {
- StringBuffer sb= new StringBuffer(300);
+ StringBuilder sb= new StringBuilder(300);
try (InputStream htmlStream = ControlExample.class.getResourceAsStream("browser-content.html");
BufferedReader br = new BufferedReader(new InputStreamReader(htmlStream))) {
@@ -219,7 +219,7 @@ class BrowserTab extends Tab {
}
public static String getContents(InputStream in) throws IOException {
- StringBuffer sb= new StringBuffer(300);
+ StringBuilder sb= new StringBuilder(300);
try (BufferedReader br= new BufferedReader(new InputStreamReader(in))) {
int read= 0;
while ((read= br.read()) != -1)
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/dnd/DNDExample.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/dnd/DNDExample.java
index ae817df8ac..ccceae24dc 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/dnd/DNDExample.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/dnd/DNDExample.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -319,7 +319,7 @@ private void createDragSource() {
if (items.length == 0) {
event.doit = false;
} else {
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
for (int i = 0; i < items.length; i++) {
buffer.append(items[i].getText());
if (items.length > 1 && i < items.length - 1) {
@@ -346,7 +346,7 @@ private void createDragSource() {
if (items.length == 0) {
event.doit = false;
} else {
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
for (int i = 0; i < items.length; i++) {
buffer.append(items[i].getText());
if (items.length > 1 && i < items.length - 1) {
@@ -362,7 +362,7 @@ private void createDragSource() {
if (strings == null || strings.length == 0) {
event.doit = false;
} else {
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
for (int i = 0; i < strings.length; i++) {
buffer.append(strings[i]);
if (strings.length > 1 && i < strings.length - 1) {
@@ -389,7 +389,7 @@ private void createDragSource() {
if (selection.length == 0) {
event.doit = false;
} else {
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
for (int i = 0; i < selection.length; i++) {
buffer.append(selection[i]);
if (selection.length > 1 && i < selection.length - 1) {
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaLineStyler.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaLineStyler.java
index ff2546fff7..743e937655 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaLineStyler.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaLineStyler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -218,7 +218,7 @@ public void parseBlockComments(String text) {
public class JavaScanner {
protected Map<String, Integer> fgKeys= null;
- protected StringBuffer fBuffer= new StringBuffer();
+ protected StringBuilder fBuffer= new StringBuilder();
protected String fDoc;
protected int fPos;
protected int fEnd;
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaViewer.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaViewer.java
index 8a51718458..3cf299785c 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaViewer.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaViewer.java
@@ -147,7 +147,7 @@ void open(String name) {
try (Reader in = new BufferedReader(new InputStreamReader(stream))) {
char[] readBuffer= new char[2048];
- StringBuffer buffer= new StringBuffer((int) file.length());
+ StringBuilder buffer= new StringBuilder((int) file.length());
int n;
while ((n = in.read(readBuffer)) > 0) {
buffer.append(readBuffer, 0, n);
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/FillLayoutTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/FillLayoutTab.java
index 4985353b7d..9a35bccbf8 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/FillLayoutTab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/FillLayoutTab.java
@@ -146,8 +146,8 @@ class FillLayoutTab extends Tab {
* Generates code for the example layout.
*/
@Override
- StringBuffer generateLayoutCode () {
- StringBuffer code = new StringBuffer ();
+ StringBuilder generateLayoutCode () {
+ StringBuilder code = new StringBuilder ();
code.append ("\t\tFillLayout fillLayout = new FillLayout ();\n");
if (fillLayout.type == SWT.VERTICAL) {
code.append ("\t\tfillLayout.type = SWT.VERTICAL;\n");
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/FormLayoutTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/FormLayoutTab.java
index 908a2be7a9..202f7b79ab 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/FormLayoutTab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/FormLayoutTab.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -325,8 +325,8 @@ class FormLayoutTab extends Tab {
* Generates code for the example layout.
*/
@Override
- StringBuffer generateLayoutCode () {
- StringBuffer code = new StringBuffer ();
+ StringBuilder generateLayoutCode () {
+ StringBuilder code = new StringBuilder ();
code.append ("\t\tFormLayout formLayout = new FormLayout ();\n");
if (formLayout.marginWidth != 0) {
code.append ("\t\tformLayout.marginWidth = " + formLayout.marginWidth + ";\n");
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/GridLayoutTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/GridLayoutTab.java
index 33e123e311..941287bd6c 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/GridLayoutTab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/GridLayoutTab.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -369,8 +369,8 @@ class GridLayoutTab extends Tab {
* Generates code for the example layout.
*/
@Override
- StringBuffer generateLayoutCode () {
- StringBuffer code = new StringBuffer ();
+ StringBuilder generateLayoutCode () {
+ StringBuilder code = new StringBuilder ();
code.append ("\t\tGridLayout gridLayout = new GridLayout (");
if (gridLayout.numColumns != 1 || gridLayout.makeColumnsEqualWidth) {
code.append (gridLayout.numColumns + ", " + gridLayout.makeColumnsEqualWidth);
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/RowLayoutTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/RowLayoutTab.java
index 1f7422e8c8..52bdfd5275 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/RowLayoutTab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/RowLayoutTab.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -250,8 +250,8 @@ class RowLayoutTab extends Tab {
* Generates code for the example layout.
*/
@Override
- StringBuffer generateLayoutCode () {
- StringBuffer code = new StringBuffer ();
+ StringBuilder generateLayoutCode () {
+ StringBuilder code = new StringBuilder ();
code.append ("\t\tRowLayout rowLayout = new RowLayout ();\n");
if (rowLayout.type == SWT.VERTICAL) {
code.append ("\t\trowLayout.type = SWT.VERTICAL;\n");
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/StackLayoutTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/StackLayoutTab.java
index 732ccc5295..9c23dfad4c 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/StackLayoutTab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/StackLayoutTab.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -157,8 +157,8 @@ class StackLayoutTab extends Tab {
* Generates code for the example layout.
*/
@Override
- StringBuffer generateLayoutCode() {
- StringBuffer code = new StringBuffer();
+ StringBuilder generateLayoutCode() {
+ StringBuilder code = new StringBuilder();
code.append("\t\tStackLayout stackLayout = new StackLayout ();\n");
if (stackLayout.marginWidth != 0) {
code.append("\t\tstackLayout.marginWidth = " + stackLayout.marginWidth + ";\n");
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/Tab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/Tab.java
index 20facd3e7b..93763fc39f 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/Tab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/Tab.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -445,7 +445,7 @@ abstract class Tab {
/**
* Generates the code needed to produce the example layout.
*/
- StringBuffer generateCode () {
+ StringBuilder generateCode () {
/* Make sure all information being entered is stored in the table */
resetEditors ();
@@ -464,8 +464,8 @@ abstract class Tab {
}
}
- /* Create StringBuffer containing the code */
- StringBuffer code = new StringBuffer ();
+ /* Create StringBuilder containing the code */
+ StringBuilder code = new StringBuilder ();
code.append ("import org.eclipse.swt.*;\n");
code.append ("import org.eclipse.swt.layout.*;\n");
code.append ("import org.eclipse.swt.widgets.*;\n");
@@ -500,16 +500,16 @@ abstract class Tab {
* Generates layout specific code for the example layout.
* Subclasses override this method.
*/
- StringBuffer generateLayoutCode () {
- return new StringBuffer ();
+ StringBuilder generateLayoutCode () {
+ return new StringBuilder ();
}
/**
- * Returns the StringBuffer for the code which will
+ * Returns the StringBuilder for the code which will
* create a child control.
*/
- StringBuffer getChildCode (Control control, int i) {
- StringBuffer code = new StringBuffer ();
+ StringBuilder getChildCode (Control control, int i) {
+ StringBuilder code = new StringBuilder ();
/* Find the type of control */
String controlClass = control.getClass().toString ();
String controlType = controlClass.substring (controlClass.lastIndexOf ('.') + 1);
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/TextEditor.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/TextEditor.java
index 35e21efdcf..c10ee2a189 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/TextEditor.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/TextEditor.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -1164,7 +1164,7 @@ public class TextEditor {
String openFile(InputStream stream) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
String line;
String lineDelimiter = styledText.getLineDelimiter();
while ((line = reader.readLine()) != null) {
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/text.txt b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/text.txt
index ce595a2190..573bfae771 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/text.txt
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/text.txt
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -568,7 +568,7 @@ public class StyledText extends Canvas {
if (pageIndex != -1) {
final int PageTagLength = StyledTextPrintOptions.PAGE_TAG.length();
- StringBuffer buffer = new StringBuffer(segment.substring (0, pageIndex));
+ StringBuilder buffer = new StringBuilder(segment.substring (0, pageIndex));
buffer.append (page);
buffer.append (segment.substring(pageIndex + PageTagLength));
segment = buffer.toString();
@@ -785,7 +785,7 @@ public class StyledText extends Canvas {
* Writes the RTF header including font table and color table.
*/
void writeHeader() {
- StringBuffer header = new StringBuffer();
+ StringBuilder header = new StringBuilder();
FontData fontData = getFont().getFontData()[0];
header.append("{\\rtf1\\ansi");
// specify code page, necessary for copy to work in bidi
@@ -991,7 +991,7 @@ public class StyledText extends Canvas {
* has been called.
*/
class TextWriter {
- private StringBuffer buffer;
+ private StringBuilder buffer;
private int startOffset; // offset of first character that will be written
private int endOffset; // offset of last character that will be written.
// 0 based from the beginning of the widget text.
@@ -1006,7 +1006,7 @@ public class StyledText extends Canvas {
* @param length length of content to write
*/
public TextWriter(int start, int length) {
- buffer = new StringBuffer(length);
+ buffer = new StringBuilder(length);
startOffset = start;
endOffset = start + length;
}
@@ -2225,7 +2225,7 @@ public void copy(int clipboardType) {
* has the SWT.SINGLE style.
*/
String getModelDelimitedText(String text) {
- StringBuffer convertedText;
+ StringBuilder convertedText;
String delimiter = getLineDelimiter();
int length = text.length();
int crIndex = 0;
@@ -2235,7 +2235,7 @@ String getModelDelimitedText(String text) {
if (length == 0) {
return text;
}
- convertedText = new StringBuffer(length);
+ convertedText = new StringBuilder(length);
while (i < length) {
if (crIndex != -1) {
crIndex = text.indexOf(SWT.CR, i);
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet133.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet133.java
index 310eb1863e..e66f1163e0 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet133.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet133.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -48,7 +48,7 @@ public class Snippet133 {
int index, end;
String textToPrint;
String tabs;
- StringBuffer wordBuffer;
+ StringBuilder wordBuffer;
public static void main(String[] args) {
new Snippet133().open();
@@ -111,7 +111,7 @@ public class Snippet133 {
try (FileInputStream stream = new FileInputStream(file.getPath())) {
Reader in = new BufferedReader(new InputStreamReader(stream));
char[] readBuffer = new char[2048];
- StringBuffer buffer = new StringBuffer((int) file.length());
+ StringBuilder buffer = new StringBuilder((int) file.length());
int n;
while ((n = in.read(readBuffer)) > 0) {
buffer.append(readBuffer, 0, n);
@@ -206,7 +206,7 @@ public class Snippet133 {
/* Create a buffer for computing tab width. */
int tabSize = 4; // is tab width a user setting in your UI?
- StringBuffer tabBuffer = new StringBuffer(tabSize);
+ StringBuilder tabBuffer = new StringBuilder(tabSize);
for (int i = 0; i < tabSize; i++) tabBuffer.append(' ');
tabs = tabBuffer.toString();
@@ -236,7 +236,7 @@ public class Snippet133 {
void printText() {
printer.startPage();
- wordBuffer = new StringBuffer();
+ wordBuffer = new StringBuilder();
x = leftMargin;
y = topMargin;
index = 0;
@@ -279,7 +279,7 @@ public class Snippet133 {
}
gc.drawString(word, x, y, false);
x += wordWidth;
- wordBuffer = new StringBuffer();
+ wordBuffer = new StringBuilder();
}
}
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet179.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet179.java
index 8eae55f7b2..44825eeea3 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet179.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet179.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -37,7 +37,7 @@ public static void main(String[] args) {
public void handleEvent(Event e) {
if (ignore) return;
e.doit = false;
- StringBuffer buffer = new StringBuffer(e.text);
+ StringBuilder buffer = new StringBuilder(e.text);
char[] chars = new char[buffer.length()];
buffer.getChars(0, chars.length, chars, 0);
if (e.character == '\b') {
@@ -91,7 +91,7 @@ public static void main(String[] args) {
}
String newText = buffer.toString();
int length = newText.length();
- StringBuffer date = new StringBuffer(text.getText());
+ StringBuilder date = new StringBuilder(text.getText());
date.replace(e.start, e.start + length, newText);
calendar.set(Calendar.YEAR, 1901);
calendar.set(Calendar.MONTH, Calendar.JANUARY);
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet196.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet196.java
index d318e23a4c..a859a3730d 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet196.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet196.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,9 +18,10 @@ package org.eclipse.swt.snippets;
* http://www.eclipse.org/swt/snippets/
*/
import java.util.regex.*;
+import java.util.regex.Pattern;
import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
@@ -52,7 +53,7 @@ public static void main(String[] args) {
if (ignore) return;
e.doit = false;
if (e.start > 13 || e.end > 14) return;
- StringBuffer buffer = new StringBuffer(e.text);
+ StringBuilder buffer = new StringBuilder(e.text);
//handle backspace
if (e.character == '\b') {
@@ -95,7 +96,7 @@ public static void main(String[] args) {
return;
}
- StringBuffer newText = new StringBuffer(defaultText);
+ StringBuilder newText = new StringBuilder(defaultText);
char[] chars = e.text.toCharArray();
int index = e.start - 1;
for (int i = 0; i < e.text.length(); i++) {
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet222.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet222.java
index 2f4423eb78..15159eb17d 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet222.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet222.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -32,7 +32,7 @@ public static void main(String[] args) {
shell.setText("StyledText Bullet Example");
shell.setLayout(new FillLayout());
final StyledText styledText = new StyledText (shell, SWT.FULL_SELECTION | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL);
- StringBuffer text = new StringBuffer();
+ StringBuilder text = new StringBuilder();
text.append("Here is StyledText with some bulleted lists:\n\n");
for (int i = 0; i < 4; i++) text.append("Red Bullet List Item " + i + "\n");
text.append("\n");
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet307.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet307.java
index 9a7d1c51e5..806c1aabd7 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet307.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet307.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -90,7 +90,7 @@ static class CustomFunction extends BrowserFunction {
}
static String createHTML () {
- StringBuffer buffer = new StringBuffer ();
+ StringBuilder buffer = new StringBuilder ();
buffer.append ("<html>\n");
buffer.append ("<head>\n");
buffer.append ("<script language=\"JavaScript\">\n");
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet338.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet338.java
index eba4f7f202..3d003ac15e 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet338.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet338.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -81,7 +81,7 @@ public static void main(String[] args) {
childShell.setDefaultButton(button);
Listener printTraverseListener = event -> {
- StringBuffer buffer = new StringBuffer("Traverse ");
+ StringBuilder buffer = new StringBuilder("Traverse ");
buffer.append(event.widget);
buffer.append(" type=");
switch (event.detail) {
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_Browser.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_Browser.java
index 80ba7887fd..cd98aa5e21 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_Browser.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_Browser.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -90,7 +90,7 @@ public class Test_org_eclipse_swt_browser_Browser extends Test_org_eclipse_swt_w
static int[] webkitGtkVersionInts = new int[3];
/** Accumiliate logs, print only if test case fails. Cleared for each test case. */
- StringBuffer testLog;
+ StringBuilder testLog;
private void testLogAppend(String msg) {
testLog.append(" " + msg + "\n");
}
@@ -133,7 +133,7 @@ public void setUp() {
shell.setText(shellTitle);
setWidget(browser); // For browser to occupy the whole shell, not just half of it.
- testLog = new StringBuffer("\nTest log:\n");
+ testLog = new StringBuilder("\nTest log:\n");
}

Back to the top