Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2017-09-09 05:26:22 +0000
committerAlexander Kurtakov2017-09-09 05:26:22 +0000
commit6c84749eeb5dec8b6a1bc2957aa117c9eb42a9b9 (patch)
tree09580831f1f1f9fd05910b89e0addecdfae97a06
parentb01ac61998096f896a01308f8f85cccf49eacdd5 (diff)
downloadeclipse.platform.ua-6c84749eeb5dec8b6a1bc2957aa117c9eb42a9b9.tar.gz
eclipse.platform.ua-6c84749eeb5dec8b6a1bc2957aa117c9eb42a9b9.tar.xz
eclipse.platform.ua-6c84749eeb5dec8b6a1bc2957aa117c9eb42a9b9.zip
Bug 520255 - Replace StringBuffer with StringBuilder in
eclipse.platform.ua Handle cheatsheets. Change-Id: I93dd8008241c0413efaf3833d37bddf6130e5503 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/MarkupParser.java8
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/CompositeCheatSheetPage.java4
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/DescriptionPanel.java14
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetParser.java10
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetSaveHelper.java4
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetCollectionElement.java2
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/RegistryReader.java14
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CoreItem.java2
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ViewUtilities.java2
9 files changed, 33 insertions, 27 deletions
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/MarkupParser.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/MarkupParser.java
index 99acee9e0..643b26dab 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/MarkupParser.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/MarkupParser.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2015 IBM Corporation and others.
+ * Copyright (c) 2006, 2017 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
@@ -23,7 +23,7 @@ public class MarkupParser {
private static String parseMarkup(Node parentNode) {
NodeList children = parentNode.getChildNodes();
- StringBuffer text = new StringBuffer();
+ StringBuilder text = new StringBuilder();
for (int i = 0; i < children.getLength(); i++) {
Node childNode = children.item(i);
if (childNode.getNodeType() == Node.TEXT_NODE) {
@@ -57,13 +57,13 @@ public class MarkupParser {
}
public static String escapeText(String input) {
- StringBuffer result = new StringBuffer(input.length() + 10);
+ StringBuilder result = new StringBuilder(input.length() + 10);
for (int i = 0; i < input.length(); ++i)
appendEscapedChar(result, input.charAt(i));
return result.toString();
}
- private static void appendEscapedChar(StringBuffer buffer, char c) {
+ private static void appendEscapedChar(StringBuilder buffer, char c) {
String replacement = getReplacement(c);
if (replacement != null) {
buffer.append(replacement);
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/CompositeCheatSheetPage.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/CompositeCheatSheetPage.java
index 8d724751c..f8d8aea16 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/CompositeCheatSheetPage.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/CompositeCheatSheetPage.java
@@ -347,7 +347,7 @@ public class CompositeCheatSheetPage extends Page implements ISelectionChangedLi
}
}
- private void addHyperlink(StringBuffer buf, String href, String imageRef, String message) {
+ private void addHyperlink(StringBuilder buf, String href, String imageRef, String message) {
buf.append("<p><a href=\""); //$NON-NLS-1$
buf.append(href);
buf.append("\">"); //$NON-NLS-1$
@@ -370,7 +370,7 @@ public class CompositeCheatSheetPage extends Page implements ISelectionChangedLi
text.setImage(DescriptionPanel.REVIEW_IMAGE, CheatSheetPlugin.getPlugin().getImage(ICheatSheetResource.COMPOSITE_TASK_REVIEW));
text.addHyperlinkListener(getEndReviewListener());
text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
buf.append("<form>"); //$NON-NLS-1$
addHyperlink(buf, END_REVIEW_TAG + task.getId(), DescriptionPanel.REVIEW_IMAGE, Messages.COMPOSITE_PAGE_END_REVIEW );
buf.append("</form>"); //$NON-NLS-1$
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/DescriptionPanel.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/DescriptionPanel.java
index 42360dd38..069b6971d 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/DescriptionPanel.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/DescriptionPanel.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2015 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 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 @@ public class DescriptionPanel {
}
public void showDescription(final ICompositeCheatSheetTask task) {
- StringBuffer upperMessage = new StringBuffer();
+ StringBuilder upperMessage = new StringBuilder();
upperMessage.append("<form>"); //$NON-NLS-1$
upperMessage.append("<p><span color=\"title\" font=\"header\">"); //$NON-NLS-1$
upperMessage.append(MarkupParser.escapeText(task.getName()));
@@ -127,7 +127,7 @@ public class DescriptionPanel {
upperMessage.append("</form>"); //$NON-NLS-1$
upperText.setText(upperMessage.toString(), true, false);
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
buf.append("<form>"); //$NON-NLS-1$
boolean startable = false;
@@ -194,7 +194,7 @@ public class DescriptionPanel {
form.reflow(true);
}
- private void showBlockingTasks(String message, final ICompositeCheatSheetTask task, StringBuffer buf) {
+ private void showBlockingTasks(String message, final ICompositeCheatSheetTask task, StringBuilder buf) {
buf.append("<p/>"); //$NON-NLS-1$
buf.append("<p>"); //$NON-NLS-1$
buf.append("<img href=\""); //$NON-NLS-1$
@@ -211,7 +211,7 @@ public class DescriptionPanel {
buf.append("</p>"); //$NON-NLS-1$
}
- private void addHyperlink(StringBuffer buf, String href, String imageRef, String message) {
+ private void addHyperlink(StringBuilder buf, String href, String imageRef, String message) {
buf.append("<p><a href=\""); //$NON-NLS-1$
buf.append(href);
buf.append("\">"); //$NON-NLS-1$
@@ -225,7 +225,7 @@ public class DescriptionPanel {
/*
* If this task is incomplete create a message to that effect
*/
- private void warnOfIncompleteTask(StringBuffer buf, ICompositeCheatSheetTask task) {
+ private void warnOfIncompleteTask(StringBuilder buf, ICompositeCheatSheetTask task) {
if (task.getState() != ICompositeCheatSheetTask.COMPLETED &&
task.getState() != ICompositeCheatSheetTask.SKIPPED ) {
buf.append("<li>"); //$NON-NLS-1$
@@ -240,7 +240,7 @@ public class DescriptionPanel {
}
}
- private void showSuccesorTaskLinks(ICompositeCheatSheetTask task, StringBuffer buf) {
+ private void showSuccesorTaskLinks(ICompositeCheatSheetTask task, StringBuilder buf) {
// Add the links to the next tasks
ICompositeCheatSheetTask[] successorTasks = new SuccesorTaskFinder(task).getRecommendedSuccessors();
for (int i = 0; i < successorTasks.length; i++) {
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetParser.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetParser.java
index d511f0caa..4fe5ddf05 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetParser.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetParser.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2015 IBM Corporation and others.
+ * Copyright (c) 2002, 2017 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
@@ -117,7 +117,7 @@ public class CheatSheetParser implements IStatusContainer {
* @param text the string buffer to have its characters escaped
* @return string buffer with any of the characters requiring XML escaping escaped
*/
- private StringBuffer escapeXMLCharacters(StringBuffer text) {
+ private StringBuilder escapeXMLCharacters(StringBuilder text) {
// Set the maximum length of the tags to ignore
final int MAXIMUM_TAG_LENGTH = 5;
@@ -125,7 +125,7 @@ public class CheatSheetParser implements IStatusContainer {
int length = text.length();
// Create the buffer to store the resulting string
- StringBuffer result = new StringBuffer(length);
+ StringBuilder result = new StringBuilder(length);
// Loop for the characters of the original string
for(int i=0; i<length; i++) {
@@ -411,7 +411,7 @@ public class CheatSheetParser implements IStatusContainer {
private String handleMarkedUpText(Node nodeContainingText, Node startNode, String nodeName ) {
NodeList nodes = nodeContainingText.getChildNodes();
- StringBuffer text = new StringBuffer();
+ StringBuilder text = new StringBuilder();
boolean containsMarkup = false;
@@ -463,7 +463,7 @@ public class CheatSheetParser implements IStatusContainer {
// Replace any tabs with spaces
- private void deTab(StringBuffer text) {
+ private void deTab(StringBuilder text) {
for (int i = 0; i < text.length(); i++) {
if (text.charAt(i) == '\t') {
text.setCharAt(i, ' ');
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetSaveHelper.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetSaveHelper.java
index b5668f425..773c67d53 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetSaveHelper.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetSaveHelper.java
@@ -103,8 +103,8 @@ public class CheatSheetSaveHelper {
ArrayList<SubItemCompositeHolder> compList = withsubs
.getListOfSubItemCompositeHolders();
if (compList != null) {
- StringBuffer skippedsubItems = new StringBuffer();
- StringBuffer completedsubItems = new StringBuffer();
+ StringBuilder skippedsubItems = new StringBuilder();
+ StringBuilder completedsubItems = new StringBuilder();
for (int j = 0; j < compList.size(); j++) {
SubItemCompositeHolder sch = compList.get(j);
if (sch.isCompleted())
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetCollectionElement.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetCollectionElement.java
index e640e068e..ae86a7698 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetCollectionElement.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetCollectionElement.java
@@ -184,7 +184,7 @@ public class CheatSheetCollectionElement extends WorkbenchAdapter implements IPl
*/
@Override
public String toString() {
- StringBuffer buf = new StringBuffer("CheatSheetCollection, "); //$NON-NLS-1$
+ StringBuilder buf = new StringBuilder("CheatSheetCollection, "); //$NON-NLS-1$
buf.append(childCollections.size());
buf.append(" children, "); //$NON-NLS-1$
buf.append(cheatsheets.size());
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/RegistryReader.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/RegistryReader.java
index 8e2ccf9b4..b0c1359f5 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/RegistryReader.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/RegistryReader.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2015 IBM Corporation and others.
+ * Copyright (c) 2002, 2017 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,14 @@
*******************************************************************************/
package org.eclipse.ui.internal.cheatsheets.registry;
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.internal.cheatsheets.*;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.ui.internal.cheatsheets.CheatSheetPlugin;
+import org.eclipse.ui.internal.cheatsheets.ICheatSheetResource;
/**
* Template implementation of a registry reader that creates objects
@@ -56,7 +62,7 @@ public abstract class RegistryReader {
*/
private void logError(IConfigurationElement element, String text) {
IExtension extension = element.getDeclaringExtension();
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
buf.append("Plugin " + extension.getContributor().getName() + ", extension " + extension.getExtensionPointUniqueIdentifier()); //$NON-NLS-2$//$NON-NLS-1$
buf.append("\n" + text); //$NON-NLS-1$
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CoreItem.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CoreItem.java
index 037d49f05..d92c77bf9 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CoreItem.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CoreItem.java
@@ -484,7 +484,7 @@ public class CoreItem extends ViewItem {
}
public String performLineSubstitution(String line, String variable, String value) {
- StringBuffer buffer = new StringBuffer(line.length());
+ StringBuilder buffer = new StringBuilder(line.length());
StringDelimitedTokenizer tokenizer = new StringDelimitedTokenizer(line, variable);
boolean addValue = false;
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ViewUtilities.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ViewUtilities.java
index 3ebbd5b1a..3038d056b 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ViewUtilities.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ViewUtilities.java
@@ -37,7 +37,7 @@ public class ViewUtilities {
}
int next = 0;
- StringBuffer result = new StringBuffer();
+ StringBuilder result = new StringBuilder();
int index = message.indexOf('&');
while (index >= 0) {
result.append(message.substring(next, index + 1));

Back to the top