Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2018-01-07 18:41:46 +0000
committerAlexander Kurtakov2018-01-07 18:41:46 +0000
commit71968b931e10c84aca29430411ad1ceb06bdf971 (patch)
tree7a5386e7da4703f7b1dfe89aa8439a3b80ce2b1e /examples/org.eclipse.swt.examples
parentfcacc9501be623cbe182e7ebf499c9f75b344964 (diff)
downloadeclipse.platform.swt-71968b931e10c84aca29430411ad1ceb06bdf971.tar.gz
eclipse.platform.swt-71968b931e10c84aca29430411ad1ceb06bdf971.tar.xz
eclipse.platform.swt-71968b931e10c84aca29430411ad1ceb06bdf971.zip
Bug 529494 - Convert to StringBuilder
Change-Id: Ic959ed6d7ae7aa50da85837105570b2b69ae66d3 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'examples/org.eclipse.swt.examples')
-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
13 files changed, 45 insertions, 45 deletions
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);

Back to the top