From 8dc69e1ca0283be6106a21afe7aee84860da34f5 Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Fri, 31 Jan 2014 11:10:24 -0800 Subject: [PATCH] Use StringBuilder instead of StringBuffer. --- .../ui/viewsupport/CElementLabelComposer.java | 724 +++++++++--------- .../ui/viewsupport/CElementLabels.java | 57 +- 2 files changed, 384 insertions(+), 397 deletions(-) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/CElementLabelComposer.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/CElementLabelComposer.java index 27608bc6dd4..e92ec46108e 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/CElementLabelComposer.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/CElementLabelComposer.java @@ -41,7 +41,6 @@ import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.cdt.internal.core.model.CoreModelMessages; - // Most parts of this file were previously located in CElementLabels. // FlexibleBuffer and sub-types are taken from JDTs JavaElementLabelComposer. @@ -49,12 +48,10 @@ import org.eclipse.cdt.internal.core.model.CoreModelMessages; * Creates labels for ICElement objects. */ public class CElementLabelComposer { - /** * An adapter for buffer supported by the label composer. */ public static abstract class FlexibleBuffer { - /** * Appends the string representation of the given character to the buffer. * @@ -93,27 +90,27 @@ public class CElementLabelComposer { } public static class FlexibleStringBuffer extends FlexibleBuffer { - private final StringBuffer fStringBuffer; + private final StringBuilder fStringBuilder; - public FlexibleStringBuffer(StringBuffer stringBuffer) { - fStringBuffer= stringBuffer; + public FlexibleStringBuffer(StringBuilder stringBuilder) { + fStringBuilder= stringBuilder; } @Override public FlexibleBuffer append(char ch) { - fStringBuffer.append(ch); + fStringBuilder.append(ch); return this; } @Override public FlexibleBuffer append(String string) { - fStringBuffer.append(string); + fStringBuilder.append(string); return this; } @Override public int length() { - return fStringBuffer.length(); + return fStringBuilder.length(); } @Override @@ -123,7 +120,7 @@ public class CElementLabelComposer { @Override public String toString() { - return fStringBuffer.toString(); + return fStringBuilder.toString(); } } @@ -161,13 +158,13 @@ public class CElementLabelComposer { return fStyledString.toString(); } } - - + + private static final Styler QUALIFIER_STYLE= StyledString.QUALIFIER_STYLER; //private static final Styler COUNTER_STYLE= StyledString.COUNTER_STYLER; private static final Styler DECORATIONS_STYLE= StyledString.DECORATIONS_STYLER; - + private final FlexibleBuffer fBuffer; /** @@ -193,86 +190,88 @@ public class CElementLabelComposer { * * @param buffer the buffer */ - public CElementLabelComposer(StringBuffer buffer) { + public CElementLabelComposer(StringBuilder buffer) { this(new FlexibleStringBuffer(buffer)); } - - + /** - * Appends the label for an element to a StringBuffer. + * Appends the label for an element to a StringBuilder. * @param element any element (IMethodDeclaration, IField, ITypeDef, IVariableDeclaration, etc.) * @param flags any of the flags (M_*, F_*, ROOT_*, etc.) defined in this class */ public void appendElementLabel(ICElement element, long flags) { int type= element.getElementType(); ISourceRoot root= null; - - if (type != ICElement.C_MODEL && type != ICElement.C_PROJECT && !(type == ICElement.C_CCONTAINER && element instanceof ISourceRoot)) + + if (type != ICElement.C_MODEL && type != ICElement.C_PROJECT && + !(type == ICElement.C_CCONTAINER && element instanceof ISourceRoot)) { root= getSourceRoot(element); + } if (root != null && getFlag(flags, CElementLabels.PREPEND_ROOT_PATH)) { getSourceRootLabel(root, CElementLabels.ROOT_QUALIFIED); fBuffer.append(CElementLabels.CONCAT_STRING); } switch (type) { - case ICElement.C_MACRO: - appendMacroLabel((IMacro) element, flags); - break; - case ICElement.C_METHOD : - case ICElement.C_METHOD_DECLARATION: - case ICElement.C_TEMPLATE_METHOD: - case ICElement.C_TEMPLATE_METHOD_DECLARATION: - appendMethodLabel( (IMethodDeclaration) element, flags); - break; - case ICElement.C_FUNCTION: - case ICElement.C_FUNCTION_DECLARATION: - case ICElement.C_TEMPLATE_FUNCTION: - case ICElement.C_TEMPLATE_FUNCTION_DECLARATION: - appendFunctionLabel( (IFunctionDeclaration) element, flags); - break; - case ICElement.C_FIELD : - appendFieldLabel( (IField) element, flags); - break; - case ICElement.C_VARIABLE: - case ICElement.C_VARIABLE_DECLARATION: - appendVariableLabel( (IVariableDeclaration) element, flags); - break; - case ICElement.C_ENUMERATOR: - appendEnumeratorLabel((IEnumerator) element, flags); - break; - case ICElement.C_CLASS: - case ICElement.C_STRUCT: - case ICElement.C_UNION: - case ICElement.C_ENUMERATION: - case ICElement.C_TEMPLATE_CLASS: - case ICElement.C_TEMPLATE_STRUCT: - case ICElement.C_TEMPLATE_UNION: - case ICElement.C_TEMPLATE_CLASS_DECLARATION: - case ICElement.C_TEMPLATE_STRUCT_DECLARATION: - case ICElement.C_TEMPLATE_UNION_DECLARATION: - case ICElement.C_NAMESPACE: - appendTypeLabel( element, flags); - break; - case ICElement.C_TYPEDEF: - appendTypeDefLabel((ITypeDef)element, flags); - break; - case ICElement.C_UNIT: - appendTranslationUnitLabel((ITranslationUnit) element, flags); - break; - case ICElement.C_CCONTAINER: - ICContainer container = (ICContainer) element; - if (container instanceof ISourceRoot) - getSourceRootLabel((ISourceRoot) container, flags); - else - appendContainerLabel(container, flags); - break; - case ICElement.C_PROJECT: - case ICElement.C_MODEL: - fBuffer.append(element.getElementName()); - break; - default: - fBuffer.append(element.getElementName()); + case ICElement.C_MACRO: + appendMacroLabel((IMacro) element, flags); + break; + case ICElement.C_METHOD : + case ICElement.C_METHOD_DECLARATION: + case ICElement.C_TEMPLATE_METHOD: + case ICElement.C_TEMPLATE_METHOD_DECLARATION: + appendMethodLabel((IMethodDeclaration) element, flags); + break; + case ICElement.C_FUNCTION: + case ICElement.C_FUNCTION_DECLARATION: + case ICElement.C_TEMPLATE_FUNCTION: + case ICElement.C_TEMPLATE_FUNCTION_DECLARATION: + appendFunctionLabel((IFunctionDeclaration) element, flags); + break; + case ICElement.C_FIELD : + appendFieldLabel((IField) element, flags); + break; + case ICElement.C_VARIABLE: + case ICElement.C_VARIABLE_DECLARATION: + appendVariableLabel((IVariableDeclaration) element, flags); + break; + case ICElement.C_ENUMERATOR: + appendEnumeratorLabel((IEnumerator) element, flags); + break; + case ICElement.C_CLASS: + case ICElement.C_STRUCT: + case ICElement.C_UNION: + case ICElement.C_ENUMERATION: + case ICElement.C_TEMPLATE_CLASS: + case ICElement.C_TEMPLATE_STRUCT: + case ICElement.C_TEMPLATE_UNION: + case ICElement.C_TEMPLATE_CLASS_DECLARATION: + case ICElement.C_TEMPLATE_STRUCT_DECLARATION: + case ICElement.C_TEMPLATE_UNION_DECLARATION: + case ICElement.C_NAMESPACE: + appendTypeLabel(element, flags); + break; + case ICElement.C_TYPEDEF: + appendTypeDefLabel((ITypeDef)element, flags); + break; + case ICElement.C_UNIT: + appendTranslationUnitLabel((ITranslationUnit) element, flags); + break; + case ICElement.C_CCONTAINER: + ICContainer container = (ICContainer) element; + if (container instanceof ISourceRoot) { + getSourceRootLabel((ISourceRoot) container, flags); + } else { + appendContainerLabel(container, flags); + } + break; + case ICElement.C_PROJECT: + case ICElement.C_MODEL: + fBuffer.append(element.getElementName()); + break; + default: + fBuffer.append(element.getElementName()); } - + if (root != null && getFlag(flags, CElementLabels.APPEND_ROOT_PATH)) { int offset= fBuffer.length(); fBuffer.append(CElementLabels.CONCAT_STRING); @@ -281,32 +280,31 @@ public class CElementLabelComposer { fBuffer.setStyle(offset, fBuffer.length() - offset, QUALIFIER_STYLE); } } - + if (element instanceof IBinary) { IBinary bin = (IBinary)element; fBuffer.append(" - [" + bin.getCPU() + "/" + (bin.isLittleEndian() ? "le" : "be") + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ } } - - + /** - * Appends the label for a macro definition to a StringBuffer. + * Appends the label for a macro definition to a StringBuilder. * @param macro a macro definition * @param flags {@link CElementLabels#MF_POST_FILE_QUALIFIED}, or 0. */ public void appendMacroLabel(IMacro macro, long flags) { fBuffer.append(macro.getElementName()); - if( getFlag( flags, CElementLabels.M_PARAMETER_TYPES ) ) { + if (getFlag(flags, CElementLabels.M_PARAMETER_TYPES)) { if (macro.isFunctionStyle()) { fBuffer.append("()"); //$NON-NLS-1$ } } - - if( getFlag(flags, CElementLabels.MF_POST_FILE_QUALIFIED)) { + + if (getFlag(flags, CElementLabels.MF_POST_FILE_QUALIFIED)) { IPath path= macro.getPath(); if (path != null) { int offset= fBuffer.length(); - fBuffer.append( CElementLabels.CONCAT_STRING ); + fBuffer.append(CElementLabels.CONCAT_STRING); fBuffer.append(path.toString()); if (getFlag(flags, CElementLabels.COLORIZE)) { fBuffer.setStyle(offset, fBuffer.length() - offset, QUALIFIER_STYLE); @@ -316,104 +314,103 @@ public class CElementLabelComposer { } /** - * Appends the label for a method declaration to a StringBuffer. + * Appends the label for a method declaration to a StringBuilder. * @param method a method declaration * @param flags any of the M_* flags, and {@link CElementLabels#MF_POST_FILE_QUALIFIED} */ - public void appendMethodLabel( IMethodDeclaration method, long flags ) { + public void appendMethodLabel(IMethodDeclaration method, long flags) { try { - //return type - if( getFlag( flags, CElementLabels.M_PRE_RETURNTYPE ) && method.exists() && !method.isConstructor() ) { - fBuffer.append( method.getReturnType() ); - fBuffer.append( ' ' ); - } - - //qualification - if( getFlag( flags, CElementLabels.M_FULLY_QUALIFIED ) ){ - ICElement parent = method.getParent(); - if (parent != null && parent.exists() && !(parent instanceof ITranslationUnit)) { - appendTypeLabel( parent, CElementLabels.T_FULLY_QUALIFIED | (flags & CElementLabels.TEMPLATE_ARGUMENTS)); - fBuffer.append( "::" ); //$NON-NLS-1$ + // return type + if (getFlag(flags, CElementLabels.M_PRE_RETURNTYPE) && method.exists() && !method.isConstructor()) { + fBuffer.append(method.getReturnType()); + fBuffer.append(' '); } - } - - if (getFlag(flags, CElementLabels.M_SIMPLE_NAME)) { - fBuffer.append(getSimpleName(method.getElementName())); - } else { - fBuffer.append(method.getElementName()); - } - - //template parameters - if (method instanceof ITemplate) { - appendTemplateParameters((ITemplate)method, flags); - } - //parameters - if( getFlag( flags, CElementLabels.M_PARAMETER_TYPES ) ) { - fBuffer.append('('); + // qualification + if (getFlag(flags, CElementLabels.M_FULLY_QUALIFIED)) { + ICElement parent = method.getParent(); + if (parent != null && parent.exists() && !(parent instanceof ITranslationUnit)) { + appendTypeLabel(parent, CElementLabels.T_FULLY_QUALIFIED | (flags & CElementLabels.TEMPLATE_ARGUMENTS)); + fBuffer.append("::"); //$NON-NLS-1$ + } + } - String[] types = method.getParameterTypes(); - - if (types != null) { - for (int i= 0; i < types.length; i++) { - if (i > 0) { - fBuffer.append( CElementLabels.COMMA_STRING ); + if (getFlag(flags, CElementLabels.M_SIMPLE_NAME)) { + fBuffer.append(getSimpleName(method.getElementName())); + } else { + fBuffer.append(method.getElementName()); + } + + // template parameters + if (method instanceof ITemplate) { + appendTemplateParameters((ITemplate)method, flags); + } + + // parameters + if (getFlag(flags, CElementLabels.M_PARAMETER_TYPES)) { + fBuffer.append('('); + + String[] types = method.getParameterTypes(); + + if (types != null) { + for (int i= 0; i < types.length; i++) { + if (i > 0) { + fBuffer.append(CElementLabels.COMMA_STRING); + } + fBuffer.append(types[i]); } - fBuffer.append( types[i] ); } + fBuffer.append(')'); } - fBuffer.append(')'); - } - - //exceptions - if( getFlag( flags, CElementLabels.M_EXCEPTIONS ) && method.exists() ){ - String [] types = method.getExceptions(); - if (types.length > 0) { - fBuffer.append(" throw( "); //$NON-NLS-1$ - for (int i= 0; i < types.length; i++) { - if (i > 0) { - fBuffer.append(CElementLabels.COMMA_STRING); + + // exceptions + if (getFlag(flags, CElementLabels.M_EXCEPTIONS) && method.exists()) { + String[] types = method.getExceptions(); + if (types.length > 0) { + fBuffer.append(" throw ("); //$NON-NLS-1$ + for (int i= 0; i < types.length; i++) { + if (i > 0) { + fBuffer.append(CElementLabels.COMMA_STRING); + } + fBuffer.append(types[i]); } - fBuffer.append( types[i] ); - } - fBuffer.append( " )" ); //$NON-NLS-1$ - } - } - - if( getFlag( flags, CElementLabels.M_APP_RETURNTYPE ) && method.exists() && !method.isConstructor() && !method.isDestructor()) { - final String typeName= method.getReturnType(); - if (typeName != null && typeName.length() > 0) { - int offset= fBuffer.length(); - fBuffer.append( CElementLabels.DECL_STRING ); - fBuffer.append(typeName); - if (getFlag(flags, CElementLabels.COLORIZE)) { - fBuffer.setStyle(offset, fBuffer.length() - offset, DECORATIONS_STYLE); + fBuffer.append(")"); //$NON-NLS-1$ } } - } - - // post qualification - if( getFlag(flags, CElementLabels.M_POST_QUALIFIED)) { - int offset= fBuffer.length(); - fBuffer.append( CElementLabels.CONCAT_STRING ); - appendTypeLabel( method.getParent(), CElementLabels.T_FULLY_QUALIFIED | (flags & CElementLabels.TEMPLATE_ARGUMENTS)); - if (getFlag(flags, CElementLabels.COLORIZE)) { - fBuffer.setStyle(offset, fBuffer.length() - offset, QUALIFIER_STYLE); - } - } - if( getFlag(flags, CElementLabels.MF_POST_FILE_QUALIFIED)) { - - IPath path= method.getPath(); - if (path != null) { + + if (getFlag(flags, CElementLabels.M_APP_RETURNTYPE) && method.exists() && !method.isConstructor() && !method.isDestructor()) { + final String typeName= method.getReturnType(); + if (typeName != null && typeName.length() > 0) { + int offset= fBuffer.length(); + fBuffer.append(CElementLabels.DECL_STRING); + fBuffer.append(typeName); + if (getFlag(flags, CElementLabels.COLORIZE)) { + fBuffer.setStyle(offset, fBuffer.length() - offset, DECORATIONS_STYLE); + } + } + } + + // post qualification + if (getFlag(flags, CElementLabels.M_POST_QUALIFIED)) { int offset= fBuffer.length(); - fBuffer.append( CElementLabels.CONCAT_STRING ); - fBuffer.append(path.toString()); + fBuffer.append(CElementLabels.CONCAT_STRING); + appendTypeLabel(method.getParent(), CElementLabels.T_FULLY_QUALIFIED | (flags & CElementLabels.TEMPLATE_ARGUMENTS)); if (getFlag(flags, CElementLabels.COLORIZE)) { fBuffer.setStyle(offset, fBuffer.length() - offset, QUALIFIER_STYLE); } } - - } + if (getFlag(flags, CElementLabels.MF_POST_FILE_QUALIFIED)) { + IPath path= method.getPath(); + if (path != null) { + int offset= fBuffer.length(); + fBuffer.append(CElementLabels.CONCAT_STRING); + fBuffer.append(path.toString()); + if (getFlag(flags, CElementLabels.COLORIZE)) { + fBuffer.setStyle(offset, fBuffer.length() - offset, QUALIFIER_STYLE); + } + } + + } } catch (CModelException e) { CUIPlugin.log(e); } @@ -428,7 +425,7 @@ public class CElementLabelComposer { private static String getSimpleName(String elementName) { int idx = elementName.lastIndexOf("::"); //$NON-NLS-1$ if (idx >= 0) { - return elementName.substring(idx+2); + return elementName.substring(idx + 2); } return elementName; } @@ -442,173 +439,173 @@ public class CElementLabelComposer { } else { return; } - + fBuffer.append('<'); if (args != null) { for (int i= 0; i < args.length; i++) { if (i > 0) { - fBuffer.append( ',' ); + fBuffer.append(','); } - fBuffer.append( args[i] ); + fBuffer.append(args[i]); } } fBuffer.append('>'); } /** - * Appends the label for a field to a StringBuffer. + * Appends the label for a field to a StringBuilder. * @param field a field * @param flags any of the F_* flags, and {@link CElementLabels#MF_POST_FILE_QUALIFIED} */ - public void appendFieldLabel(IField field, long flags ) { + public void appendFieldLabel(IField field, long flags) { try { - //return type - if( getFlag( flags, CElementLabels.F_PRE_TYPE_SIGNATURE ) && field.exists()) { - fBuffer.append( field.getTypeName() ); - fBuffer.append( ' ' ); - } - - //qualification - if( getFlag( flags, CElementLabels.F_FULLY_QUALIFIED ) ){ - ICElement parent = field.getParent(); - if (parent != null && parent.exists()) { - appendTypeLabel( parent, CElementLabels.T_FULLY_QUALIFIED | (flags & CElementLabels.TEMPLATE_PARAMETERS)); - fBuffer.append( "::" ); //$NON-NLS-1$ + // return type + if (getFlag(flags, CElementLabels.F_PRE_TYPE_SIGNATURE) && field.exists()) { + fBuffer.append(field.getTypeName()); + fBuffer.append(' '); } - } - - if (getFlag(flags, CElementLabels.F_SIMPLE_NAME)) { - fBuffer.append(getSimpleName(field.getElementName())); - } else { - fBuffer.append(field.getElementName()); - } - - if( getFlag( flags, CElementLabels.F_APP_TYPE_SIGNATURE ) && field.exists()) { - int offset= fBuffer.length(); - fBuffer.append( CElementLabels.DECL_STRING ); - fBuffer.append( field.getTypeName() ); - if (getFlag(flags, CElementLabels.COLORIZE)) { - fBuffer.setStyle(offset, fBuffer.length() - offset, DECORATIONS_STYLE); + + // qualification + if (getFlag(flags, CElementLabels.F_FULLY_QUALIFIED)) { + ICElement parent = field.getParent(); + if (parent != null && parent.exists()) { + appendTypeLabel(parent, CElementLabels.T_FULLY_QUALIFIED | (flags & CElementLabels.TEMPLATE_PARAMETERS)); + fBuffer.append("::"); //$NON-NLS-1$ + } } - } - - // post qualification - if( getFlag(flags, CElementLabels.F_POST_QUALIFIED)) { - int offset= fBuffer.length(); - fBuffer.append( CElementLabels.CONCAT_STRING ); - appendTypeLabel( field.getParent(), CElementLabels.T_FULLY_QUALIFIED | (flags & CElementLabels.TEMPLATE_PARAMETERS)); - if (getFlag(flags, CElementLabels.COLORIZE)) { - fBuffer.setStyle(offset, fBuffer.length() - offset, QUALIFIER_STYLE); + + if (getFlag(flags, CElementLabels.F_SIMPLE_NAME)) { + fBuffer.append(getSimpleName(field.getElementName())); + } else { + fBuffer.append(field.getElementName()); } - } - if( getFlag(flags, CElementLabels.MF_POST_FILE_QUALIFIED)) { - IPath path= field.getPath(); - if (path != null) { + + if (getFlag(flags, CElementLabels.F_APP_TYPE_SIGNATURE) && field.exists()) { int offset= fBuffer.length(); - fBuffer.append( CElementLabels.CONCAT_STRING ); - fBuffer.append(path.toString()); + fBuffer.append(CElementLabels.DECL_STRING); + fBuffer.append(field.getTypeName()); + if (getFlag(flags, CElementLabels.COLORIZE)) { + fBuffer.setStyle(offset, fBuffer.length() - offset, DECORATIONS_STYLE); + } + } + + // post qualification + if (getFlag(flags, CElementLabels.F_POST_QUALIFIED)) { + int offset= fBuffer.length(); + fBuffer.append(CElementLabels.CONCAT_STRING); + appendTypeLabel(field.getParent(), CElementLabels.T_FULLY_QUALIFIED | (flags & CElementLabels.TEMPLATE_PARAMETERS)); if (getFlag(flags, CElementLabels.COLORIZE)) { fBuffer.setStyle(offset, fBuffer.length() - offset, QUALIFIER_STYLE); } } + if (getFlag(flags, CElementLabels.MF_POST_FILE_QUALIFIED)) { + IPath path= field.getPath(); + if (path != null) { + int offset= fBuffer.length(); + fBuffer.append(CElementLabels.CONCAT_STRING); + fBuffer.append(path.toString()); + if (getFlag(flags, CElementLabels.COLORIZE)) { + fBuffer.setStyle(offset, fBuffer.length() - offset, QUALIFIER_STYLE); + } + } - } + } } catch (CModelException e) { CUIPlugin.log(e); } } /** - * Appends the label for a variable declaration to a StringBuffer. + * Appends the label for a variable declaration to a StringBuilder. * @param var a variable declaration * @param flags any of the F_* flags, and {@link CElementLabels#MF_POST_FILE_QUALIFIED} */ - public void appendVariableLabel(IVariableDeclaration var, long flags ) { + public void appendVariableLabel(IVariableDeclaration var, long flags) { try { - //return type - if( getFlag( flags, CElementLabels.F_PRE_TYPE_SIGNATURE ) && var.exists()) { - fBuffer.append( var.getTypeName() ); - fBuffer.append( ' ' ); - } - - //qualification - if( getFlag( flags, CElementLabels.F_FULLY_QUALIFIED ) ){ - ICElement parent = var.getParent(); - if (parent != null && parent.exists() && parent.getElementType() == ICElement.C_NAMESPACE) { - appendTypeLabel( parent, CElementLabels.T_FULLY_QUALIFIED); - fBuffer.append( "::" ); //$NON-NLS-1$ + // return type + if (getFlag(flags, CElementLabels.F_PRE_TYPE_SIGNATURE) && var.exists()) { + fBuffer.append(var.getTypeName()); + fBuffer.append(' '); } - } - - fBuffer.append( var.getElementName() ); - - if( getFlag( flags, CElementLabels.F_APP_TYPE_SIGNATURE ) && var.exists()) { - int offset= fBuffer.length(); - fBuffer.append( CElementLabels.DECL_STRING ); - fBuffer.append( var.getTypeName() ); - if (getFlag(flags, CElementLabels.COLORIZE)) { - fBuffer.setStyle(offset, fBuffer.length() - offset, DECORATIONS_STYLE); + + // qualification + if (getFlag(flags, CElementLabels.F_FULLY_QUALIFIED)) { + ICElement parent = var.getParent(); + if (parent != null && parent.exists() && parent.getElementType() == ICElement.C_NAMESPACE) { + appendTypeLabel(parent, CElementLabels.T_FULLY_QUALIFIED); + fBuffer.append("::"); //$NON-NLS-1$ + } } - } - - // post qualification - if( getFlag(flags, CElementLabels.F_POST_QUALIFIED)) { - ICElement parent = var.getParent(); - if (parent != null && parent.exists() && parent.getElementType() == ICElement.C_NAMESPACE) { + + fBuffer.append(var.getElementName()); + + if (getFlag(flags, CElementLabels.F_APP_TYPE_SIGNATURE) && var.exists()) { int offset= fBuffer.length(); - fBuffer.append( CElementLabels.CONCAT_STRING ); - appendTypeLabel( var.getParent(), CElementLabels.T_FULLY_QUALIFIED); + fBuffer.append(CElementLabels.DECL_STRING); + fBuffer.append(var.getTypeName()); if (getFlag(flags, CElementLabels.COLORIZE)) { fBuffer.setStyle(offset, fBuffer.length() - offset, DECORATIONS_STYLE); } + } + + // post qualification + if (getFlag(flags, CElementLabels.F_POST_QUALIFIED)) { + ICElement parent = var.getParent(); + if (parent != null && parent.exists() && parent.getElementType() == ICElement.C_NAMESPACE) { + int offset= fBuffer.length(); + fBuffer.append(CElementLabels.CONCAT_STRING); + appendTypeLabel(var.getParent(), CElementLabels.T_FULLY_QUALIFIED); + if (getFlag(flags, CElementLabels.COLORIZE)) { + fBuffer.setStyle(offset, fBuffer.length() - offset, DECORATIONS_STYLE); + } + } } - } - if( getFlag(flags, CElementLabels.MF_POST_FILE_QUALIFIED)) { - int offset= fBuffer.length(); - IPath path= var.getPath(); - if (path != null) { - fBuffer.append( CElementLabels.CONCAT_STRING ); - fBuffer.append(path.toString()); + if (getFlag(flags, CElementLabels.MF_POST_FILE_QUALIFIED)) { + int offset= fBuffer.length(); + IPath path= var.getPath(); + if (path != null) { + fBuffer.append(CElementLabels.CONCAT_STRING); + fBuffer.append(path.toString()); + } + if (getFlag(flags, CElementLabels.COLORIZE)) { + fBuffer.setStyle(offset, fBuffer.length() - offset, QUALIFIER_STYLE); + } } - if (getFlag(flags, CElementLabels.COLORIZE)) { - fBuffer.setStyle(offset, fBuffer.length() - offset, QUALIFIER_STYLE); - } - } } catch (CModelException e) { CUIPlugin.log(e); } } /** - * Appends the label for an enumerator to a StringBuffer. + * Appends the label for an enumerator to a StringBuilder. * @param var an enumerator * @param flags any of the F_* flags, and {@link CElementLabels#MF_POST_FILE_QUALIFIED} */ - public void appendEnumeratorLabel(IEnumerator var, long flags ) { - //qualification - if( getFlag( flags, CElementLabels.F_FULLY_QUALIFIED ) ){ + public void appendEnumeratorLabel(IEnumerator var, long flags) { + // qualification + if (getFlag(flags, CElementLabels.F_FULLY_QUALIFIED)) { ICElement parent = var.getParent(); if (parent != null && parent.exists() && parent.getElementType() == ICElement.C_NAMESPACE) { - appendTypeLabel( parent, CElementLabels.T_FULLY_QUALIFIED); - fBuffer.append( "::" ); //$NON-NLS-1$ + appendTypeLabel(parent, CElementLabels.T_FULLY_QUALIFIED); + fBuffer.append("::"); //$NON-NLS-1$ } } - - fBuffer.append( var.getElementName() ); - + + fBuffer.append(var.getElementName()); + // post qualification - if( getFlag(flags, CElementLabels.F_POST_QUALIFIED)) { + if (getFlag(flags, CElementLabels.F_POST_QUALIFIED)) { ICElement parent = var.getParent(); if (parent != null && parent.exists() && parent.getElementType() == ICElement.C_NAMESPACE) { - fBuffer.append( CElementLabels.CONCAT_STRING ); - appendTypeLabel( var.getParent(), CElementLabels.T_FULLY_QUALIFIED); + fBuffer.append(CElementLabels.CONCAT_STRING); + appendTypeLabel(var.getParent(), CElementLabels.T_FULLY_QUALIFIED); } } - if( getFlag(flags, CElementLabels.MF_POST_FILE_QUALIFIED)) { + if (getFlag(flags, CElementLabels.MF_POST_FILE_QUALIFIED)) { int offset= fBuffer.length(); IPath path= var.getPath(); if (path != null) { - fBuffer.append( CElementLabels.CONCAT_STRING ); + fBuffer.append(CElementLabels.CONCAT_STRING); fBuffer.append(path.toString()); } if (getFlag(flags, CElementLabels.COLORIZE)) { @@ -618,90 +615,90 @@ public class CElementLabelComposer { } /** - * Appends the label for a function declaration to a StringBuffer. + * Appends the label for a function declaration to a StringBuilder. * @param func a function declaration * @param flags any of the M_* flags, and {@link CElementLabels#MF_POST_FILE_QUALIFIED} */ public void appendFunctionLabel(IFunctionDeclaration func, long flags) { - //return type - if( getFlag( flags, CElementLabels.M_PRE_RETURNTYPE ) && func.exists()) { - fBuffer.append( func.getReturnType() ); - fBuffer.append( ' ' ); + // return type + if (getFlag(flags, CElementLabels.M_PRE_RETURNTYPE) && func.exists()) { + fBuffer.append(func.getReturnType()); + fBuffer.append(' '); } - - //qualification - if( getFlag( flags, CElementLabels.M_FULLY_QUALIFIED ) ){ + + // qualification + if (getFlag(flags, CElementLabels.M_FULLY_QUALIFIED)) { ICElement parent = func.getParent(); if (parent != null && parent.exists() && parent.getElementType() == ICElement.C_NAMESPACE) { - appendTypeLabel( parent, CElementLabels.T_FULLY_QUALIFIED); - fBuffer.append( "::" ); //$NON-NLS-1$ + appendTypeLabel(parent, CElementLabels.T_FULLY_QUALIFIED); + fBuffer.append("::"); //$NON-NLS-1$ } } - - fBuffer.append( func.getElementName() ); - //template parameters + fBuffer.append(func.getElementName()); + + // template parameters if (func instanceof ITemplate) { appendTemplateParameters((ITemplate)func, flags); } - //parameters - if( getFlag( flags, CElementLabels.M_PARAMETER_TYPES ) ) { + // parameters + if (getFlag(flags, CElementLabels.M_PARAMETER_TYPES)) { fBuffer.append('('); String[] types = func.getParameterTypes(); - + if (types != null) { - for (int i= 0; i < types.length; i++) { - if (i > 0) { - fBuffer.append( CElementLabels.COMMA_STRING ); - } - fBuffer.append( types[i] ); - } - } - fBuffer.append(')'); - } - - //exceptions - if( getFlag( flags, CElementLabels.M_EXCEPTIONS ) && func.exists() ){ - String [] types = func.getExceptions(); - if (types.length > 0) { - fBuffer.append(" throw( "); //$NON-NLS-1$ for (int i= 0; i < types.length; i++) { if (i > 0) { fBuffer.append(CElementLabels.COMMA_STRING); } - fBuffer.append( types[i] ); + fBuffer.append(types[i]); } - fBuffer.append( " )" ); //$NON-NLS-1$ + } + fBuffer.append(')'); + } + + // exceptions + if (getFlag(flags, CElementLabels.M_EXCEPTIONS) && func.exists()) { + String[] types = func.getExceptions(); + if (types.length > 0) { + fBuffer.append(" throw ("); //$NON-NLS-1$ + for (int i= 0; i < types.length; i++) { + if (i > 0) { + fBuffer.append(CElementLabels.COMMA_STRING); + } + fBuffer.append(types[i]); + } + fBuffer.append(")"); //$NON-NLS-1$ } } - - if( getFlag( flags, CElementLabels.M_APP_RETURNTYPE ) && func.exists()) { + + if (getFlag(flags, CElementLabels.M_APP_RETURNTYPE) && func.exists()) { final String typeName= func.getReturnType(); if (typeName != null && typeName.length() > 0) { int offset= fBuffer.length(); - fBuffer.append( CElementLabels.DECL_STRING ); + fBuffer.append(CElementLabels.DECL_STRING); fBuffer.append(typeName); if (getFlag(flags, CElementLabels.COLORIZE)) { fBuffer.setStyle(offset, fBuffer.length() - offset, DECORATIONS_STYLE); } } } - + // post qualification - if( getFlag(flags, CElementLabels.M_POST_QUALIFIED)) { + if (getFlag(flags, CElementLabels.M_POST_QUALIFIED)) { ICElement parent = func.getParent(); if (parent != null && parent.exists() && parent.getElementType() == ICElement.C_NAMESPACE) { - fBuffer.append( CElementLabels.CONCAT_STRING ); - appendTypeLabel( func.getParent(), CElementLabels.T_FULLY_QUALIFIED); + fBuffer.append(CElementLabels.CONCAT_STRING); + appendTypeLabel(func.getParent(), CElementLabels.T_FULLY_QUALIFIED); } } - if( getFlag(flags, CElementLabels.MF_POST_FILE_QUALIFIED)) { + if (getFlag(flags, CElementLabels.MF_POST_FILE_QUALIFIED)) { IPath path= func.getPath(); if (path != null) { int offset= fBuffer.length(); - fBuffer.append( CElementLabels.CONCAT_STRING ); + fBuffer.append(CElementLabels.CONCAT_STRING); fBuffer.append(path.toString()); if (getFlag(flags, CElementLabels.COLORIZE)) { fBuffer.setStyle(offset, fBuffer.length() - offset, QUALIFIER_STYLE); @@ -711,53 +708,53 @@ public class CElementLabelComposer { } /** - * Appends the label for a type definition to a StringBuffer. + * Appends the label for a type definition to a StringBuilder. * @param typedef a type definition * @param flags any of the F_* flags, and CElementLabels.MF_POST_FILE_QUALIFIED */ - public void appendTypeDefLabel(ITypeDef typedef, long flags ) { + public void appendTypeDefLabel(ITypeDef typedef, long flags) { // type - if( getFlag( flags, CElementLabels.F_PRE_TYPE_SIGNATURE ) && typedef.exists()) { - fBuffer.append( typedef.getTypeName() ); - fBuffer.append( ' ' ); + if (getFlag(flags, CElementLabels.F_PRE_TYPE_SIGNATURE) && typedef.exists()) { + fBuffer.append(typedef.getTypeName()); + fBuffer.append(' '); } - - //qualification - if( getFlag( flags, CElementLabels.F_FULLY_QUALIFIED ) ){ + + // qualification + if (getFlag(flags, CElementLabels.F_FULLY_QUALIFIED)) { ICElement parent = typedef.getParent(); if (parent != null && parent.exists() && parent.getElementType() == ICElement.C_NAMESPACE) { - appendTypeLabel( parent, CElementLabels.T_FULLY_QUALIFIED); - fBuffer.append( "::" ); //$NON-NLS-1$ + appendTypeLabel(parent, CElementLabels.T_FULLY_QUALIFIED); + fBuffer.append("::"); //$NON-NLS-1$ } } - - fBuffer.append( typedef.getElementName() ); - - if( getFlag( flags, CElementLabels.F_APP_TYPE_SIGNATURE ) && typedef.exists()) { + + fBuffer.append(typedef.getElementName()); + + if (getFlag(flags, CElementLabels.F_APP_TYPE_SIGNATURE) && typedef.exists()) { String typeName= typedef.getTypeName(); if (typeName != null && typeName.length() > 0) { int offset= fBuffer.length(); - fBuffer.append( CElementLabels.DECL_STRING ); + fBuffer.append(CElementLabels.DECL_STRING); fBuffer.append(typeName); if (getFlag(flags, CElementLabels.COLORIZE)) { fBuffer.setStyle(offset, fBuffer.length() - offset, DECORATIONS_STYLE); } } } - + // post qualification - if( getFlag(flags, CElementLabels.F_POST_QUALIFIED)) { + if (getFlag(flags, CElementLabels.F_POST_QUALIFIED)) { ICElement parent = typedef.getParent(); if (parent != null && parent.exists() && parent.getElementType() == ICElement.C_NAMESPACE) { - fBuffer.append( CElementLabels.CONCAT_STRING ); - appendTypeLabel( typedef.getParent(), CElementLabels.T_FULLY_QUALIFIED); + fBuffer.append(CElementLabels.CONCAT_STRING); + appendTypeLabel(typedef.getParent(), CElementLabels.T_FULLY_QUALIFIED); } } - if( getFlag(flags, CElementLabels.MF_POST_FILE_QUALIFIED)) { + if (getFlag(flags, CElementLabels.MF_POST_FILE_QUALIFIED)) { IPath path= typedef.getPath(); if (path != null) { int offset= fBuffer.length(); - fBuffer.append( CElementLabels.CONCAT_STRING ); + fBuffer.append(CElementLabels.CONCAT_STRING); fBuffer.append(path.toString()); if (getFlag(flags, CElementLabels.COLORIZE)) { fBuffer.setStyle(offset, fBuffer.length() - offset, QUALIFIER_STYLE); @@ -767,16 +764,16 @@ public class CElementLabelComposer { } /** - * Appends the label for a source root to a StringBuffer. + * Appends the label for a source root to a StringBuilder. * @param root a source root * @param flags any of the ROOT_* flags, and PROJECT_POST_QUALIFIED */ public void getSourceRootLabel(ISourceRoot root, long flags) { appendFolderLabel(root, flags); } - + /** - * Appends the label for a container to a StringBuffer. + * Appends the label for a container to a StringBuilder. * @param container a container * @param flags any of the ROOT_* flags, and PROJECT_POST_QUALIFIED */ @@ -792,14 +789,13 @@ public class CElementLabelComposer { } else { if (CCorePlugin.showSourceRootsAtTopOfProject()) { fBuffer.append(container.getElementName()); - } - else { + } else { String elementName = container.getElementName(); IPath path = new Path(elementName); fBuffer.append(path.lastSegment()); } if (getFlag(flags, CElementLabels.ROOT_QUALIFIED)) { - if (resource != null && container instanceof ISourceRoot && isReferenced((ISourceRoot)container)) { + if (resource != null && container instanceof ISourceRoot && isReferenced((ISourceRoot) container)) { fBuffer.append(CElementLabels.CONCAT_STRING); fBuffer.append(resource.getProject().getName()); } else { @@ -811,7 +807,7 @@ public class CElementLabelComposer { } /** - * Appends the label for a translation unit to a StringBuffer. + * Appends the label for a translation unit to a StringBuilder. * @param tu a translation unit * @param flags any of the TU_* flags */ @@ -820,31 +816,27 @@ public class CElementLabelComposer { IPath path; if (r != null) { path= r.getFullPath().makeRelative(); - } - else { + } else { path= tu.getPath(); } - + if (path == null) { fBuffer.append(tu.getElementName()); - } - else { + } else { if (getFlag(flags, CElementLabels.TU_QUALIFIED)) { fBuffer.append(path.toString()); - } - else if (getFlag(flags, CElementLabels.TU_POST_QUALIFIED)) { + } else if (getFlag(flags, CElementLabels.TU_POST_QUALIFIED)) { fBuffer.append(path.lastSegment()); fBuffer.append(CElementLabels.CONCAT_STRING); fBuffer.append(path.removeLastSegments(1).toString()); - } - else { + } else { fBuffer.append(path.lastSegment()); } } } /** - * Appends the label for a type to a StringBuffer. + * Appends the label for a type to a StringBuilder. * @param elem a type * @param flags any of the T_* flags, and {@link CElementLabels#MF_POST_FILE_QUALIFIED} */ @@ -872,10 +864,10 @@ public class CElementLabelComposer { fBuffer.append("::"); //$NON-NLS-1$ } } - + String typeName= elem.getElementName(); if (typeName.length() == 0) { // anonymous - typeName = CoreModelMessages.getString("CElementLabels.anonymous"); //$NON-NLS-1$ + typeName = CoreModelMessages.getString("CElementLabels.anonymous"); //$NON-NLS-1$ } fBuffer.append(typeName); @@ -895,16 +887,16 @@ public class CElementLabelComposer { } } - //template parameters + // template parameters if (elem instanceof ITemplate) { appendTemplateParameters((ITemplate)elem, flags); } - - if( getFlag(flags, CElementLabels.MF_POST_FILE_QUALIFIED)) { + + if (getFlag(flags, CElementLabels.MF_POST_FILE_QUALIFIED)) { IPath path= elem.getPath(); if (path != null) { int offset= fBuffer.length(); - fBuffer.append( CElementLabels.CONCAT_STRING ); + fBuffer.append(CElementLabels.CONCAT_STRING); fBuffer.append(path.toString()); if (getFlag(flags, CElementLabels.COLORIZE)) { fBuffer.setStyle(offset, fBuffer.length() - offset, QUALIFIER_STYLE); @@ -912,12 +904,12 @@ public class CElementLabelComposer { } } } - + private static boolean isCLanguage(ICElement elem) { while (elem != null) { elem= elem.getParent(); if (elem instanceof ITranslationUnit) { - return ((ITranslationUnit) elem).isCLanguage(); + return ((ITranslationUnit) elem).isCLanguage(); } } return false; @@ -930,12 +922,10 @@ public class CElementLabelComposer { * @return "public", "protected" or "private" */ private static String getVisibility(ASTAccessVisibility access) { - if (access == ASTAccessVisibility.PUBLIC) { + if (access == ASTAccessVisibility.PUBLIC) return "public"; //$NON-NLS-1$ - } - if (access == ASTAccessVisibility.PROTECTED) { + if (access == ASTAccessVisibility.PROTECTED) return "protected"; //$NON-NLS-1$ - } return "private"; //$NON-NLS-1$ } @@ -943,7 +933,6 @@ public class CElementLabelComposer { return (flags & flag) != 0; } - /** * Returns the source root of ICElement. If the given * element is already a source root, the element itself is returned. @@ -960,12 +949,11 @@ public class CElementLabelComposer { } return null; } - + /** - * Returns true if the given source root is - * referenced. This means it is own by a different project but is referenced - * by the root's parent. Returns false if the given root - * doesn't have an underlying resource. + * Returns {@code true} if the given source root is referenced. This means it is owned + * by a different project but is referenced by the root's parent. Returns {@code false} + * if the given root doesn't have an underlying resource. */ public static boolean isReferenced(ISourceRoot root) { IResource resource= root.getResource(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/CElementLabels.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/CElementLabels.java index 13655c3d081..9ba924447e8 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/CElementLabels.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/CElementLabels.java @@ -55,7 +55,7 @@ public class CElementLabels { /** * Method names contain thrown exceptions. - * e.g. foo throw( IOException ) + * e.g. foo throw (IOException) */ public final static long M_EXCEPTIONS= 1L << 2; @@ -233,7 +233,6 @@ public class CElementLabels { public final static String DECL_STRING = CoreModelMessages.getString("CElementLabels.declseparator_string"); // " "; // use for return type //$NON-NLS-1$ - //==================== @@ -241,8 +240,8 @@ public class CElementLabels { } /** - * Returns the label of the given object. The object must be of type {@link ICElement} or adapt to {@link IWorkbenchAdapter}. - * If the element type is not known, the empty string is returned. + * Returns the label of the given object. The object must be of type {@link ICElement} or adapt + * to {@link IWorkbenchAdapter}. If the element type is not known, the empty string is returned. * The returned label is BiDi-processed with {@link TextProcessor#process(String, String)}. * * @param obj object to get the label for @@ -269,9 +268,10 @@ public class CElementLabels { } /** - * Returns the styled label of the given object. The object must be of type {@link ICElement} or adapt to {@link IWorkbenchAdapter}. - * If the element type is not known, the empty string is returned. - * The returned label is BiDi-processed with {@link TextProcessor#process(String, String)}. + * Returns the styled label of the given object. The object must be of type {@link ICElement} + * or adapt to {@link IWorkbenchAdapter}. If the element type is not known, the empty string is + * returned. The returned label is BiDi-processed with + * {@link TextProcessor#process(String, String)}. * * @param obj object to get the label for * @param flags the rendering flags @@ -329,7 +329,7 @@ public class CElementLabels { * @return the label of the Java element */ public static String getElementLabel(ICElement element, long flags) { - StringBuffer result= new StringBuffer(); + StringBuilder result= new StringBuilder(); getElementLabel(element, flags, result); return Strings.markCElementLabelLTR(result.toString()); } @@ -355,7 +355,7 @@ public class CElementLabels { * @param flags the rendering flags * @param buf the buffer to append the resulting label to */ - public static void getElementLabel(ICElement element, long flags, StringBuffer buf) { + public static void getElementLabel(ICElement element, long flags, StringBuilder buf) { new CElementLabelComposer(buf).appendElementLabel(element, flags); } @@ -371,12 +371,12 @@ public class CElementLabels { } /** - * Appends the label for a macro definition to a StringBuffer. + * Appends the label for a macro definition to a StringBuilder. * @param macro a macro definition * @param flags {@link #MF_POST_FILE_QUALIFIED}, or 0. * @param buf the buffer to append the label to. */ - public static void getMacroLabel(IMacro macro, int flags, StringBuffer buf) { + public static void getMacroLabel(IMacro macro, int flags, StringBuilder buf) { new CElementLabelComposer(buf).appendMacroLabel(macro, flags); } @@ -392,12 +392,12 @@ public class CElementLabels { } /** - * Appends the label for a method declaration to a StringBuffer. + * Appends the label for a method declaration to a StringBuilder. * @param method a method declaration * @param flags any of the M_* flags, and MF_POST_FILE_QUALIFIED * @param buf the buffer to append the label */ - public static void getMethodLabel( IMethodDeclaration method, int flags, StringBuffer buf ) { + public static void getMethodLabel(IMethodDeclaration method, int flags, StringBuilder buf) { new CElementLabelComposer(buf).appendMethodLabel(method, flags); } @@ -413,12 +413,12 @@ public class CElementLabels { } /** - * Appends the label for a field to a StringBuffer. + * Appends the label for a field to a StringBuilder. * @param field a field * @param flags any of the F_* flags, and MF_POST_FILE_QUALIFIED * @param buf the buffer to append the label */ - public static void getFieldLabel(IField field, int flags, StringBuffer buf ) { + public static void getFieldLabel(IField field, int flags, StringBuilder buf) { new CElementLabelComposer(buf).appendFieldLabel(field, flags); } @@ -428,17 +428,17 @@ public class CElementLabels { * @param flags any of the F_* flags, and MF_POST_FILE_QUALIFIED * @param result the buffer to append the label */ - public static void getFieldLabel(IField field, int flags, StyledString result ) { + public static void getFieldLabel(IField field, int flags, StyledString result) { new CElementLabelComposer(result).appendFieldLabel(field, flags); } /** - * Appends the label for a variable declaration to a StringBuffer. + * Appends the label for a variable declaration to a StringBuilder. * @param var a variable declaration * @param flags any of the F_* flags, and MF_POST_FILE_QUALIFIED * @param buf the buffer to append the label */ - public static void getVariableLabel(IVariableDeclaration var, int flags, StringBuffer buf ) { + public static void getVariableLabel(IVariableDeclaration var, int flags, StringBuilder buf) { new CElementLabelComposer(buf).appendVariableLabel(var, flags); } @@ -448,17 +448,17 @@ public class CElementLabels { * @param flags any of the F_* flags, and MF_POST_FILE_QUALIFIED * @param result the buffer to append the label */ - public static void getVariableLabel(IVariableDeclaration var, int flags, StyledString result ) { + public static void getVariableLabel(IVariableDeclaration var, int flags, StyledString result) { new CElementLabelComposer(result).appendVariableLabel(var, flags); } /** - * Appends the label for an enumerator to a StringBuffer. + * Appends the label for an enumerator to a StringBuilder. * @param var an enumerator * @param flags any of the F_* flags, and MF_POST_FILE_QUALIFIED * @param buf the buffer to append the label */ - public static void getEnumeratorLabel(IEnumerator var, int flags, StringBuffer buf ) { + public static void getEnumeratorLabel(IEnumerator var, int flags, StringBuilder buf) { new CElementLabelComposer(buf).appendEnumeratorLabel(var, flags); } @@ -468,17 +468,17 @@ public class CElementLabels { * @param flags any of the F_* flags, and MF_POST_FILE_QUALIFIED * @param result the buffer to append the label */ - public static void getEnumeratorLabel(IEnumerator var, int flags, StyledString result ) { + public static void getEnumeratorLabel(IEnumerator var, int flags, StyledString result) { new CElementLabelComposer(result).appendEnumeratorLabel(var, flags); } /** - * Appends the label for a function declaration to a StringBuffer. + * Appends the label for a function declaration to a StringBuilder. * @param func a function declaration * @param flags any of the M_* flags, and MF_POST_FILE_QUALIFIED * @param buf the buffer to append the label */ - public static void getFunctionLabel(IFunctionDeclaration func, int flags, StringBuffer buf) { + public static void getFunctionLabel(IFunctionDeclaration func, int flags, StringBuilder buf) { new CElementLabelComposer(buf).appendFunctionLabel(func, flags); } @@ -489,16 +489,16 @@ public class CElementLabels { * @param result the buffer to append the label */ public static void getFunctionLabel(IFunctionDeclaration func, int flags, StyledString result) { - new CElementLabelComposer(result).appendFunctionLabel(func, flags); + new CElementLabelComposer(result).appendFunctionLabel(func, flags); } /** - * Appends the label for a type definition to a StringBuffer. + * Appends the label for a type definition to a StringBuilder. * @param typedef a type definition * @param flags any of the F_* flags, and MF_POST_FILE_QUALIFIED * @param buf the buffer to append the label */ - public static void getTypeDefLabel(ITypeDef typedef, int flags, StringBuffer buf ) { + public static void getTypeDefLabel(ITypeDef typedef, int flags, StringBuilder buf) { new CElementLabelComposer(buf).appendTypeDefLabel(typedef, flags); } @@ -508,8 +508,7 @@ public class CElementLabels { * @param flags any of the F_* flags, and MF_POST_FILE_QUALIFIED * @param result the buffer to append the label */ - public static void getTypeDefLabel(ITypeDef typedef, int flags, StyledString result ) { + public static void getTypeDefLabel(ITypeDef typedef, int flags, StyledString result) { new CElementLabelComposer(result).appendTypeDefLabel(typedef, flags); } - }