if (getFlag(flags, M_CATEGORY) && method.exists()) { String[] categories= method.getCategories(); if (categories.length > 0) { buf.append(categories[0]); buf.append(CONCAT_STRING); } }
	public static void getMethodLabel(IMethod method, long flags, StringBuffer buf) {		try {			BindingKey resolvedKey= getFlag(flags, USE_RESOLVED) && method.isResolved() ? new BindingKey(method.getKey()) : null;			String resolvedSig= (resolvedKey != null) ? resolvedKey.toSignature() : null;						// category			if (getFlag(flags, M_CATEGORY) && method.exists()) {				String[] categories= method.getCategories();				if (categories.length > 0) {					buf.append(categories[0]);					buf.append(CONCAT_STRING);				}			}						// type parameters			if (getFlag(flags, M_PRE_TYPE_PARAMETERS)) {				if (resolvedKey != null) {					if (resolvedKey.isParameterizedMethod()) {						String[] typeArgRefs= resolvedKey.getTypeArguments();						if (typeArgRefs.length > 0) {							getTypeArgumentSignaturesLabel(typeArgRefs, flags, buf);							buf.append(' ');						}					} else {						String[] typeParameterSigs= Signature.getTypeParameters(resolvedSig);						if (typeParameterSigs.length > 0) {							getTypeParameterSignaturesLabel(typeParameterSigs, flags, buf);							buf.append(' ');						}					}				} else if (method.exists()) {					ITypeParameter[] typeParameters= method.getTypeParameters();					if (typeParameters.length > 0) {						getTypeParametersLabel(typeParameters, flags, buf);						buf.append(' ');					}				}			}						// return type			if (getFlag(flags, M_PRE_RETURNTYPE) && method.exists() && !method.isConstructor()) {				String returnTypeSig= resolvedSig != null ? Signature.getReturnType(resolvedSig) : method.getReturnType();				getTypeSignatureLabel(returnTypeSig, flags, buf);				buf.append(' ');			}						// qualification			if (getFlag(flags, M_FULLY_QUALIFIED)) {				getTypeLabel(method.getDeclaringType(), T_FULLY_QUALIFIED | (flags & QUALIFIER_FLAGS), buf);				buf.append('.');			}							buf.append(method.getElementName());						// parameters			buf.append('(');			if (getFlag(flags, M_PARAMETER_TYPES | M_PARAMETER_NAMES)) {				String[] types= null;				int nParams= 0;				boolean renderVarargs= false;				if (getFlag(flags, M_PARAMETER_TYPES)) {					if (resolvedKey != null) {						types= Signature.getParameterTypes(resolvedKey.toSignature());					} else {						types= method.getParameterTypes();					}					nParams= types.length;					renderVarargs= method.exists() && Flags.isVarargs(method.getFlags());				}				String[] names= null;				if (getFlag(flags, M_PARAMETER_NAMES) && method.exists()) {					names= method.getParameterNames();					if (types == null) {						nParams= names.length;					} else {						if (nParams != names.length) {							// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=99137 and							// https://bugs.eclipse.org/bugs/show_bug.cgi?id=101029							// JavaPlugin.logErrorMessage("JavaElementLabels: Number of param types(" + nParams + ") != number of names(" + names.length + "): " + method.getElementName());   //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$							names= null; // no names rendered						}					}				}								for (int i= 0; i < nParams; i++) {					if (i > 0) {						buf.append(COMMA_STRING);					}					if (types != null) {						String paramSig= types[i];						if (renderVarargs && (i == nParams - 1)) {							int newDim= Signature.getArrayCount(paramSig) - 1;							getTypeSignatureLabel(Signature.getElementType(paramSig), flags, buf);							for (int k= 0; k < newDim; k++) {								buf.append('[').append(']');							}							buf.append(ELLIPSIS_STRING);						} else {							getTypeSignatureLabel(paramSig, flags, buf);						}					}					if (names != null) {						if (types != null) {							buf.append(' ');						}						buf.append(names[i]);					}				}			} else {				if (method.getParameterTypes().length > 0) {					buf.append(ELLIPSIS_STRING);				}			}			buf.append(')');								if (getFlag(flags, M_EXCEPTIONS)) {				String[] types;				if (resolvedSig != null) {					types= Signature.getThrownExceptionTypes(resolvedSig);				} else {					types= method.exists() ? method.getExceptionTypes() : new String[0];				}				if (types.length > 0) {					buf.append(" throws "); //$NON-NLS-1$					for (int i= 0; i < types.length; i++) {						if (i > 0) {							buf.append(COMMA_STRING);						}						getTypeSignatureLabel(types[i], flags, buf);					}				}			}						if (getFlag(flags, M_APP_TYPE_PARAMETERS)) {				if (resolvedKey != null) {					if (resolvedKey.isParameterizedMethod()) {						String[] typeArgRefs= resolvedKey.getTypeArguments();						if (typeArgRefs.length > 0) {							buf.append(' ');							getTypeArgumentSignaturesLabel(typeArgRefs, flags, buf);						}					} else {						String[] typeParameterSigs= Signature.getTypeParameters(resolvedSig);						if (typeParameterSigs.length > 0) {							buf.append(' ');							getTypeParameterSignaturesLabel(typeParameterSigs, flags, buf);						}					}				} else if (method.exists()) {					ITypeParameter[] typeParameters= method.getTypeParameters();					if (typeParameters.length > 0) {						buf.append(' ');						getTypeParametersLabel(typeParameters, flags, buf);					}				}								}						if (getFlag(flags, M_APP_RETURNTYPE) && method.exists() && !method.isConstructor()) {				buf.append(DECL_STRING);				String returnTypeSig= resolvedSig != null ? Signature.getReturnType(resolvedSig) : method.getReturnType();				getTypeSignatureLabel(returnTypeSig, flags, buf);			}									// post qualification			if (getFlag(flags, M_POST_QUALIFIED)) {				buf.append(CONCAT_STRING);				getTypeLabel(method.getDeclaringType(), T_FULLY_QUALIFIED | (flags & QUALIFIER_FLAGS), buf);			}								} catch (JavaModelException e) {			JavaPlugin.log(e); // NotExistsException will not reach this point		}	}