From ae78d6feeb2c8a7159edcbd9249278aae99355a0 Mon Sep 17 00:00:00 2001 From: Alexander Kurtakov Date: Sat, 9 Sep 2017 08:44:53 +0300 Subject: Bug 520255 - Replace StringBuffer with StringBuilder in eclipse.platform.ua Handle intro* bundles but skipping parts which required public methods signature changes. Change-Id: Ib60f65f5b4f54d1327b106b32fcd729816140116 Signed-off-by: Alexander Kurtakov --- .../intro/impl/html/FormattedHTMLElement.java | 8 ++--- .../ui/internal/intro/impl/html/HTMLElement.java | 4 +-- .../ui/internal/intro/impl/html/HTMLUtil.java | 4 +-- .../intro/impl/html/IntroHTMLGenerator.java | 28 +++++++-------- .../internal/intro/impl/model/IntroModelRoot.java | 4 +-- .../intro/impl/model/IntroSearchParticipant.java | 8 ++--- .../impl/model/loader/IntroContentParser.java | 8 ++--- .../intro/impl/model/loader/ModelLoaderUtil.java | 6 ++-- .../ui/internal/intro/impl/model/url/IntroURL.java | 8 ++--- .../BrowserIntroPartImplementation.java | 2 +- .../intro/impl/presentations/IntroLaunchBar.java | 10 +++--- .../internal/intro/impl/swt/PageStyleManager.java | 4 +-- .../internal/intro/impl/swt/PageWidgetFactory.java | 6 ++-- .../intro/impl/util/IntroModelSerializer.java | 42 +++++++++++----------- 14 files changed, 71 insertions(+), 71 deletions(-) (limited to 'org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro') diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/FormattedHTMLElement.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/FormattedHTMLElement.java index 065e09586..c5f5e4ab7 100644 --- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/FormattedHTMLElement.java +++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/FormattedHTMLElement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2016 IBM Corporation and others. + * Copyright (c) 2004, 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 @@ -88,9 +88,9 @@ public class FormattedHTMLElement extends HTMLElement { * the number of tabs to insert * @return */ - private StringBuffer getIndent(int indentLevel) { + private StringBuilder getIndent(int indentLevel) { // figure out the tab width - StringBuffer indent = new StringBuffer(); + StringBuilder indent = new StringBuilder(); for (int i = 0; i < indentLevel; i++) { indent.append(IIntroHTMLConstants.SMALL_TAB); } @@ -98,7 +98,7 @@ public class FormattedHTMLElement extends HTMLElement { } @Override public String toString() { - StringBuffer element = new StringBuffer(); + StringBuilder element = new StringBuilder(); // insert the indent element.append(getIndent(indentLevel)); // add the start tag and attributes diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/HTMLElement.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/HTMLElement.java index d2babce9e..ee1871af3 100644 --- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/HTMLElement.java +++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/HTMLElement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2016 IBM Corporation and others. + * Copyright (c) 2004, 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 @@ -127,7 +127,7 @@ public class HTMLElement { @Override public String toString() { - StringBuffer element = new StringBuffer(); + StringBuilder element = new StringBuilder(); // add the start tag and attributes element.append( diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/HTMLUtil.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/HTMLUtil.java index 37b495f28..14dedac0a 100644 --- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/HTMLUtil.java +++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/HTMLUtil.java @@ -95,7 +95,7 @@ public final class HTMLUtil { /** * Given a map of attribute names and values, this method will create a - * StringBuffer of the attributes in the form: attrName="attrValue". These + * StringBuilder of the attributes in the form: attrName="attrValue". These * attributes can appear in the start tag of an HTML element. * * @param attributes @@ -105,7 +105,7 @@ public final class HTMLUtil { public static String createAttributeList(Map attributes) { if (attributes == null) return null; - StringBuffer attributeList = new StringBuffer(); + StringBuilder attributeList = new StringBuilder(); Set attrNames = attributes.keySet(); for (Iterator it = attrNames.iterator(); it.hasNext();) { Object name = it.next(); diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/IntroHTMLGenerator.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/IntroHTMLGenerator.java index c5489cd35..7e3825f83 100644 --- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/IntroHTMLGenerator.java +++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/IntroHTMLGenerator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2009 IBM Corporation and others. + * Copyright (c) 2004, 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 @@ -204,7 +204,7 @@ public class IntroHTMLGenerator { // implementation level (which would apply to ALL pages) and at the // page level (which would apply only to that particular page). // For the implementation's head contribution: - StringBuffer content = null; + StringBuilder content = null; IntroHead introHead = IntroPlugin.getDefault().getIntroModelRoot().getPresentation().getHead(); if (introHead != null) { content = readFromFile(introHead.getSrc(), introHead.getInlineEncoding()); @@ -397,7 +397,7 @@ public class IntroHTMLGenerator { indentLevel + 1, true); link.addAttribute(IIntroHTMLConstants.ATTRIBUTE_HREF, href); link.addAttribute(IIntroHTMLConstants.ATTRIBUTE_CLASS, "section-title-link"); //$NON-NLS-1$ - StringBuffer call = new StringBuffer(); + StringBuilder call = new StringBuilder(); call.append("return (toggleSection('");//$NON-NLS-1$ call.append(clientId); call.append("','");//$NON-NLS-1$ @@ -471,7 +471,7 @@ public class IntroHTMLGenerator { if (mixinStyle == null) return; String key = "class"; //$NON-NLS-1$ - String original = (String) element.getElementAttributes().get(key); + String original = element.getElementAttributes().get(key); if (original == null) original = mixinStyle; else @@ -679,7 +679,7 @@ public class IntroHTMLGenerator { // make sure to ask model for encoding. If encoding is null (ie: not // specified in // markup, local encoding is used. - StringBuffer content = readFromFile(element.getSrc(), element.getInlineEncoding()); + StringBuilder content = readFromFile(element.getSrc(), element.getInlineEncoding()); if (content != null && content.length() > 0) { // Create the outer div element String divClass = (element.getStyleId() != null) ? element.getStyleId() @@ -1126,7 +1126,7 @@ public class IntroHTMLGenerator { /** * Reads the content of the file referred to by the src parameter and returns the - * content in the form of a StringBuffer. If the file read contains substitution segments of the + * content in the form of a StringBuilder. If the file read contains substitution segments of the * form $plugin:plugin_id$ then this method will make the proper substitution (the segment will * be replaced with the absolute path to the plugin with id plugin_id). * @@ -1135,13 +1135,13 @@ public class IntroHTMLGenerator { * @param charsetName - * the encoding of the file to be read. If null, local encoding is used. But the * default of the model is UTF-8, so we should not get a null encoding. - * @return a StringBuffer containing the content in the file, or null + * @return a StringBuilder containing the content in the file, or null */ - private StringBuffer readFromFile(String src, String charsetName) { + private StringBuilder readFromFile(String src, String charsetName) { if (src == null) return null; InputStream stream = null; - StringBuffer content = new StringBuffer(); + StringBuilder content = new StringBuilder(); BufferedReader reader = null; try { URL url = new URL(src); @@ -1220,16 +1220,16 @@ public class IntroHTMLGenerator { // tokenContent will contain all characters read by the parser, starting // with and including the initial $ token. - private StringBuffer tokenContent; + private StringBuilder tokenContent; // pluginId will contain the content between the "$plugin:" segment // and the closing "$" token - private StringBuffer pluginId; + private StringBuilder pluginId; protected PluginIdParser(int tokenBegin, BufferedReader bufferedreader) { reader = bufferedreader; - tokenContent = new StringBuffer(); - pluginId = new StringBuffer(); + tokenContent = new StringBuilder(); + pluginId = new StringBuilder(); // make sure tokenBegin is in char range before making cast if (tokenBegin > 0x00 && tokenBegin < 0xffff) tokenContent.append((char) tokenBegin); @@ -1285,7 +1285,7 @@ public class IntroHTMLGenerator { * This method should be called after an initial substitution character has been found (that * is, after a $). It looks at the subsequent characters in the input stream to determine if * they match the expected plugin: segment of the substitution string. If the - * expected characters are found, they will be appended to the tokenContent StringBuffer and + * expected characters are found, they will be appended to the tokenContent StringBuilder and * the method will return true. If they are not found, false is returned and the caller * should reset the BufferedReader to the position it was in before this method was called. * diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroModelRoot.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroModelRoot.java index 109c80bc5..6d2968174 100644 --- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroModelRoot.java +++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroModelRoot.java @@ -507,7 +507,7 @@ public class IntroModelRoot extends AbstractIntroContainer { addUnfilteredExtensions(elements, extensionContents); addUnfilteredExtensions(elements, replacementContents); - return (Element[])elements.toArray(new Element[elements.size()]); + return elements.toArray(new Element[elements.size()]); } private void addUnfilteredExtensions(List elements, Element[] extensionContents) { @@ -905,7 +905,7 @@ public class IntroModelRoot extends AbstractIntroContainer { return text; // resolve boolean inVariable=false; - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); int vindex=0; for (int i=0; i 0) { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); TitleAndSummary titleSummary = new TitleAndSummary(); addChildren(children, buf, doc, titleSummary); String contents = buf.toString(); @@ -174,7 +174,7 @@ public class IntroSearchParticipant extends SearchParticipant { return index.addSearchableDocument(pluginId, name, url, page.getId(), doc); } - private void addChildren(AbstractIntroElement[] children, StringBuffer buf, ISearchDocument doc, TitleAndSummary titleSummary) { + private void addChildren(AbstractIntroElement[] children, StringBuilder buf, ISearchDocument doc, TitleAndSummary titleSummary) { for (int i = 0; i < children.length; i++) { AbstractIntroElement child = children[i]; if (child instanceof IntroLink) { @@ -210,7 +210,7 @@ public class IntroSearchParticipant extends SearchParticipant { } } - private void appendNewText(StringBuffer buf, String text) { + private void appendNewText(StringBuilder buf, String text) { if (text == null) return; if (buf.length() > 0) buf.append(" "); //$NON-NLS-1$ diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/IntroContentParser.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/IntroContentParser.java index 3f56b59f1..9e9658c10 100644 --- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/IntroContentParser.java +++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/IntroContentParser.java @@ -90,7 +90,7 @@ public class IntroContentParser { return document; } catch (SAXParseException spe) { - StringBuffer buffer = new StringBuffer("IntroParser error in line "); //$NON-NLS-1$ + StringBuilder buffer = new StringBuilder("IntroParser error in line "); //$NON-NLS-1$ buffer.append(spe.getLineNumber()); buffer.append(", uri "); //$NON-NLS-1$ buffer.append(spe.getSystemId()); @@ -143,8 +143,8 @@ public class IntroContentParser { DOMSource source = new DOMSource(document); - StringWriter stringBuffer = new StringWriter(); - StreamResult result = new StreamResult(stringBuffer); + StringWriter stringWriter = new StringWriter(); + StreamResult result = new StreamResult(stringWriter); // setup properties, for doctype. DocumentType docType = document.getDoctype(); @@ -167,7 +167,7 @@ public class IntroContentParser { + "XHTML requires document types to be defined."); //$NON-NLS-1$ transformer.transform(source, result); - return stringBuffer.toString(); + return stringWriter.toString(); } catch (TransformerConfigurationException tce) { // Error generated by the parser diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/ModelLoaderUtil.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/ModelLoaderUtil.java index 17328f01e..c03539f84 100644 --- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/ModelLoaderUtil.java +++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/ModelLoaderUtil.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2007 IBM Corporation and others. + * Copyright (c) 2004, 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 @@ -84,7 +84,7 @@ public class ModelLoaderUtil { */ public static String getLogString(IConfigurationElement element, String logAttribute) { - StringBuffer buffer = new StringBuffer(element.getName()); + StringBuilder buffer = new StringBuilder(element.getName()); buffer.append(" element"); //$NON-NLS-1$ if (logAttribute != null) { buffer.append(" with "); //$NON-NLS-1$ @@ -108,7 +108,7 @@ public class ModelLoaderUtil { */ public static String getLogString(Bundle bundle, Element element, String logAttribute) { - StringBuffer buffer = new StringBuffer(element.getNodeName()); + StringBuilder buffer = new StringBuilder(element.getNodeName()); buffer.append(" element"); //$NON-NLS-1$ if (logAttribute != null) { buffer.append(" with "); //$NON-NLS-1$ diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/url/IntroURL.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/url/IntroURL.java index 40734c936..5c30bed89 100644 --- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/url/IntroURL.java +++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/url/IntroURL.java @@ -234,7 +234,7 @@ public class IntroURL implements IIntroURL { introPart.getControl().setData(IIntroConstants.SHOW_STANDBY_PART, VALUE_TRUE); IntroPlugin.setIntroStandby(true); - StandbyPart standbyPart = (StandbyPart) introPart + StandbyPart standbyPart = introPart .getAdapter(StandbyPart.class); boolean success = standbyPart.showContentPart(partId, input); @@ -552,7 +552,7 @@ public class IntroURL implements IIntroURL { // intro is closed. Do nothing. return false; - IntroPartPresentation presentation = (IntroPartPresentation) introPart + IntroPartPresentation presentation = introPart .getAdapter(IntroPartPresentation.class); if (direction.equalsIgnoreCase(VALUE_BACKWARD)) @@ -614,7 +614,7 @@ public class IntroURL implements IIntroURL { } // custom command. execute it. - StringBuffer url = new StringBuffer(); + StringBuilder url = new StringBuilder(); url.append("http://org.eclipse.ui.intro/"); //$NON-NLS-1$ url.append(command.getReplaceValue().trim()); if (command.getReplaceValue().indexOf("?") == -1) //$NON-NLS-1$ @@ -637,7 +637,7 @@ public class IntroURL implements IIntroURL { * @return */ private String retrieveInitialQuery() { - StringBuffer query = new StringBuffer(); + StringBuilder query = new StringBuilder(); Enumeration keys = parameters.keys(); while (keys.hasMoreElements()) { String key = (String) keys.nextElement(); diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/presentations/BrowserIntroPartImplementation.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/presentations/BrowserIntroPartImplementation.java index e2555d0ff..91200739a 100644 --- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/presentations/BrowserIntroPartImplementation.java +++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/presentations/BrowserIntroPartImplementation.java @@ -168,7 +168,7 @@ public class BrowserIntroPartImplementation extends IntroPlugin.getDefault().resetVolatileImageRegistry(); part = PlatformUI.getWorkbench().getIntroManager().showIntro(window, standby); if (part != null && !standby) { - StringBuffer url = new StringBuffer(); + StringBuilder url = new StringBuilder(); url.append("http://org.eclipse.ui.intro/showPage?id="); //$NON-NLS-1$ url.append(currentPageId); IIntroURL introURL = IntroURLFactory.createIntroURL(url.toString()); diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/presentations/IntroLaunchBar.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/presentations/IntroLaunchBar.java index 6dc3bab73..a2292c2ae 100644 --- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/presentations/IntroLaunchBar.java +++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/presentations/IntroLaunchBar.java @@ -189,8 +189,8 @@ public class IntroLaunchBar { */ public static IntroLaunchBar create(IWorkbenchWindow window, IntroModelRoot modelRoot, IntroLaunchBarElement element) { - EModelService modelService = (EModelService) window.getService(EModelService.class); - MTrimmedWindow trimmedWindow = (MTrimmedWindow) window.getService(MTrimmedWindow.class); + EModelService modelService = window.getService(EModelService.class); + MTrimmedWindow trimmedWindow = window.getService(MTrimmedWindow.class); MToolControl trimControl = modelService.createModelElement(MToolControl.class); trimControl.setElementId(LAUNCHBAR_ID); @@ -275,12 +275,12 @@ public class IntroLaunchBar { void init(Composite parent, MToolControl trimControl) { simple = true; this.trimControl = trimControl; - this.lastPageId = (String) trimControl.getPersistedState().get(LAST_PAGE_ID); + this.lastPageId = trimControl.getPersistedState().get(LAST_PAGE_ID); // Handle situation where intro information is not available from the // the application's IEclipseContext if (element == null || theme == null) { - String configId = (String) trimControl.getPersistedState().get(INTRO_CONFIG_ID); + String configId = trimControl.getPersistedState().get(INTRO_CONFIG_ID); IntroModelRoot modelRoot = IntroPlugin.getDefault().getExtensionPointManager().getModel(configId); element = modelRoot.getPresentation().getLaunchBarElement(); theme = modelRoot.getTheme(); @@ -612,7 +612,7 @@ public class IntroLaunchBar { IIntroPart intro = closeLaunchBar(true); if (intro == null) return; - StringBuffer url = new StringBuffer(); + StringBuilder url = new StringBuilder(); url.append(LAUNCH_COMMAND_BASE); url.append(id); IIntroURL introURL = IntroURLFactory.createIntroURL(url.toString()); diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageStyleManager.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageStyleManager.java index f34a81386..d15a61038 100644 --- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageStyleManager.java +++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageStyleManager.java @@ -146,7 +146,7 @@ public class PageStyleManager extends SharedStyleManager { @Override protected StyleContext getAssociatedContext(String key) { Properties aProperties = findPropertyOwner(key); - StyleContext context = (StyleContext) altStyleContexts.get(aProperties); + StyleContext context = altStyleContexts.get(aProperties); if (context != null) return context; return super.getAssociatedContext(key); @@ -507,7 +507,7 @@ public class PageStyleManager extends SharedStyleManager { String qualifier) { if (link==null || link.getId()==null) return ""; //$NON-NLS-1$ - StringBuffer buff = new StringBuffer(); + StringBuilder buff = new StringBuilder(); buff.append(page.getId()); buff.append("."); //$NON-NLS-1$ buff.append(link.getId()); diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageWidgetFactory.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageWidgetFactory.java index c0bfde650..db26c240a 100644 --- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageWidgetFactory.java +++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageWidgetFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2016 IBM Corporation and others. + * Copyright (c) 2004, 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 @@ -447,7 +447,7 @@ public class PageWidgetFactory { * added. */ private String generateFormText(String text) { - StringBuffer sbuf = new StringBuffer(); + StringBuilder sbuf = new StringBuilder(); sbuf.append("
"); //$NON-NLS-1$ if (text.startsWith("

")) //$NON-NLS-1$ sbuf.append(text); @@ -467,7 +467,7 @@ public class PageWidgetFactory { * @return */ private String generateBoldFormText(String text) { - StringBuffer sbuf = new StringBuffer(); + StringBuilder sbuf = new StringBuilder(); sbuf.append(""); //$NON-NLS-1$ sbuf.append("

"); //$NON-NLS-1$ sbuf.append(""); //$NON-NLS-1$ diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/IntroModelSerializer.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/IntroModelSerializer.java index 9db69684a..8698c42cb 100644 --- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/IntroModelSerializer.java +++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/IntroModelSerializer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2016 IBM Corporation and others. + * Copyright (c) 2004, 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 @@ -36,7 +36,7 @@ import org.osgi.framework.Bundle; */ public class IntroModelSerializer { - private StringBuffer buffer; + private StringBuilder buffer; private boolean filter; public IntroModelSerializer(IntroModelRoot root) { @@ -44,7 +44,7 @@ public class IntroModelSerializer { } public IntroModelSerializer(IntroModelRoot root, boolean filter) { - this.buffer = new StringBuffer(); + this.buffer = new StringBuilder(); this.filter = filter; printModelRootInfo(root, buffer); @@ -74,7 +74,7 @@ public class IntroModelSerializer { return url; } - private void printModelRootInfo(IntroModelRoot model, StringBuffer text) { + private void printModelRootInfo(IntroModelRoot model, StringBuilder text) { text.append("\nIntro Model Content:"); //$NON-NLS-1$ text.append("\n======================"); //$NON-NLS-1$ text.append("\n\nModel has valid config = " + model.hasValidConfig()); //$NON-NLS-1$ @@ -103,7 +103,7 @@ public class IntroModelSerializer { * @param text * @param root */ - private void printHomePage(AbstractIntroPage rootPage, StringBuffer text) { + private void printHomePage(AbstractIntroPage rootPage, StringBuilder text) { text.append("\n\nHOME PAGE: "); //$NON-NLS-1$ text.append("\n--------------"); //$NON-NLS-1$ text @@ -118,7 +118,7 @@ public class IntroModelSerializer { printPageStyles(rootPage, text); } - private void printPageStyles(AbstractIntroPage page, StringBuffer text) { + private void printPageStyles(AbstractIntroPage page, StringBuilder text) { text.append("\n\tpage styles are = "); //$NON-NLS-1$ String[] styles = page.getStyles(); for (int i = 0; i < styles.length; i++) @@ -135,7 +135,7 @@ public class IntroModelSerializer { } } - private void printPageChildren(AbstractIntroPage page, StringBuffer text) { + private void printPageChildren(AbstractIntroPage page, StringBuilder text) { text.append("\n\tpage children = " + page.getChildren().length); //$NON-NLS-1$ text.append("\n"); //$NON-NLS-1$ @@ -144,7 +144,7 @@ public class IntroModelSerializer { } private void printContainerChildren(AbstractIntroContainer container, - StringBuffer text, String indent) { + StringBuilder text, String indent) { AbstractIntroElement[] children = container.getChildren(); for (int i = 0; i < children.length; i++) { @@ -192,7 +192,7 @@ public class IntroModelSerializer { } } - private void printGroup(StringBuffer text, IntroGroup group, String indent) { + private void printGroup(StringBuilder text, IntroGroup group, String indent) { text.append(indent + "GROUP: id = " + group.getId()); //$NON-NLS-1$ indent = indent + "\t\t"; //$NON-NLS-1$ text.append(indent + "label = " + group.getLabel()); //$NON-NLS-1$ @@ -201,7 +201,7 @@ public class IntroModelSerializer { printContainerChildren(group, text, indent + "\t\t"); //$NON-NLS-1$ } - private void printLink(StringBuffer text, IntroLink link, String indent) { + private void printLink(StringBuilder text, IntroLink link, String indent) { text.append(indent + "LINK: id = " + link.getId()); //$NON-NLS-1$ indent = indent + "\t\t"; //$NON-NLS-1$ text.append(indent + "label = " + link.getLabel()); //$NON-NLS-1$ @@ -210,14 +210,14 @@ public class IntroModelSerializer { text.append(indent + "style-id = " + link.getStyleId()); //$NON-NLS-1$ } - private void printText(StringBuffer text, IntroText introText, String indent) { + private void printText(StringBuilder text, IntroText introText, String indent) { text.append(indent + "TEXT: id = " + introText.getId()); //$NON-NLS-1$ indent = indent + "\t\t"; //$NON-NLS-1$ text.append(indent + "text = " + introText.getText()); //$NON-NLS-1$ text.append(indent + "style-id = " + introText.getStyleId()); //$NON-NLS-1$ } - private void printImage(StringBuffer text, IntroImage image, String indent) { + private void printImage(StringBuilder text, IntroImage image, String indent) { text.append(indent + "IMAGE: id = " + image.getId()); //$NON-NLS-1$ indent = indent + "\t\t"; //$NON-NLS-1$ text.append(indent + "src = " + image.getSrc()); //$NON-NLS-1$ @@ -225,13 +225,13 @@ public class IntroModelSerializer { text.append(indent + "style-id = " + image.getStyleId()); //$NON-NLS-1$ } - private void printSeparator(StringBuffer text, IntroSeparator sep, String indent) { + private void printSeparator(StringBuilder text, IntroSeparator sep, String indent) { text.append(indent + "HR: id = " + sep.getId()); //$NON-NLS-1$ indent = indent + "\t\t"; //$NON-NLS-1$ text.append(indent + "style-id = " + sep.getStyleId()); //$NON-NLS-1$ } - private void printHtml(StringBuffer text, IntroHTML html, String indent) { + private void printHtml(StringBuilder text, IntroHTML html, String indent) { text.append(indent + "HTML: id = " + html.getId()); //$NON-NLS-1$ indent = indent + "\t\t"; //$NON-NLS-1$ text.append(indent + "src = " + html.getSrc()); //$NON-NLS-1$ @@ -244,7 +244,7 @@ public class IntroModelSerializer { } - private void printInclude(StringBuffer text, IntroInclude include, + private void printInclude(StringBuilder text, IntroInclude include, String indent) { text.append(indent + "INCLUDE: configId = " + include.getConfigId()); //$NON-NLS-1$ indent = indent + "\t\t"; //$NON-NLS-1$ @@ -252,11 +252,11 @@ public class IntroModelSerializer { text.append(indent + "merge-style = " + include.getMergeStyle()); //$NON-NLS-1$ } - private void printHead(StringBuffer text, IntroHead head, String indent) { + private void printHead(StringBuilder text, IntroHead head, String indent) { text.append(indent + "HEAD: src = " + head.getSrc()); //$NON-NLS-1$ } - private void printPageTitle(StringBuffer text, IntroPageTitle title, + private void printPageTitle(StringBuilder text, IntroPageTitle title, String indent) { text.append(indent + "TITLE: id = " + title.getId()); //$NON-NLS-1$ indent = indent + "\t\t"; //$NON-NLS-1$ @@ -264,12 +264,12 @@ public class IntroModelSerializer { text.append(indent + "style-id = " + title.getStyleId()); //$NON-NLS-1$ } - private void printAnchor(StringBuffer text, IntroAnchor anchor, + private void printAnchor(StringBuilder text, IntroAnchor anchor, String indent) { text.append(indent + "ANCHOR: id = " + anchor.getId()); //$NON-NLS-1$ } - private void printContentProvidor(StringBuffer text, + private void printContentProvidor(StringBuilder text, IntroContentProvider provider, String indent) { text.append(indent + "CONTENT PROVIDER: id = " + provider.getId()); //$NON-NLS-1$ indent = indent + "\t\t"; //$NON-NLS-1$ @@ -285,7 +285,7 @@ public class IntroModelSerializer { * * @param text */ - private void printPages(IntroPage[] pages, StringBuffer text) { + private void printPages(IntroPage[] pages, StringBuilder text) { for (int i = 0; i < pages.length; i++) { text.append("\n\nPAGE id = " + pages[i].getId()); //$NON-NLS-1$ text.append("\n----------"); //$NON-NLS-1$ @@ -298,7 +298,7 @@ public class IntroModelSerializer { } } - private void printModelFlagTests(IntroModelRoot model, StringBuffer text) { + private void printModelFlagTests(IntroModelRoot model, StringBuilder text) { text.append("Model Flag Tests: "); //$NON-NLS-1$ text.append("\n----------------"); //$NON-NLS-1$ if (model.getPages().length == 0) { -- cgit v1.2.3