org.eclipse.xtext.xbase.validation.UIStrings Java Examples
The following examples show how to use
org.eclipse.xtext.xbase.validation.UIStrings.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SARLUIStrings.java From sarl with Apache License 2.0 | 5 votes |
/** Format the parameters. * * @param elements the list of the formal parameters. * @param isVarArgs indicates if the function has var args. * @param includeName indicates if the names are included in the replied valued. * @param keywords the keyword provider. * @param annotationFinder the finder of attached annotations. * @param utils the utility. * @return the string representation of the parameters. */ public static String getParameterString(Iterable<? extends JvmFormalParameter> elements, boolean isVarArgs, boolean includeName, SARLGrammarKeywordAccess keywords, AnnotationLookup annotationFinder, UIStrings utils) { final StringBuilder result = new StringBuilder(); boolean needsSeparator = false; final Iterator<? extends JvmFormalParameter> iterator = elements.iterator(); while (iterator.hasNext()) { final JvmFormalParameter parameter = iterator.next(); if (needsSeparator) { result.append(keywords.getCommaKeyword()).append(" "); //$NON-NLS-1$ } needsSeparator = true; final boolean isDefaultValued = annotationFinder.findAnnotation(parameter, DefaultValue.class) != null; if (isDefaultValued) { result.append(keywords.getLeftSquareBracketKeyword()); } if (includeName) { result.append(parameter.getName()).append(" "); //$NON-NLS-1$ result.append(keywords.getColonKeyword()).append(" "); //$NON-NLS-1$ } JvmTypeReference typeRef = parameter.getParameterType(); if (isVarArgs && !iterator.hasNext() && typeRef instanceof JvmGenericArrayTypeReference) { typeRef = ((JvmGenericArrayTypeReference) typeRef).getComponentType(); result.append(utils.referenceToString(typeRef, NULL_TYPE)); result.append(keywords.getWildcardAsteriskKeyword()); } else { result.append(utils.referenceToString(typeRef, NULL_TYPE)); } if (isDefaultValued) { result.append(keywords.getRightSquareBracketKeyword()); } } return result.toString(); }
Example #2
Source File: SARLUIStrings.java From sarl with Apache License 2.0 | 5 votes |
/** Format the parameters. * * @param elements the list of the formal parameters. * @param isVarArgs indicates if the function has var args. * @param includeName indicates if the names are included in the replied valued. * @param keywords the keyword provider. * @param annotationFinder the finder of attached annotations. * @param utils the utility. * @return the string representation of the parameters. * @since 0.6 */ public static StyledString getParameterStyledString(Iterable<? extends JvmFormalParameter> elements, boolean isVarArgs, boolean includeName, SARLGrammarKeywordAccess keywords, AnnotationLookup annotationFinder, UIStrings utils) { final StyledString result = new StyledString(); boolean needsSeparator = false; final Iterator<? extends JvmFormalParameter> iterator = elements.iterator(); while (iterator.hasNext()) { final JvmFormalParameter parameter = iterator.next(); if (needsSeparator) { result.append(keywords.getCommaKeyword()).append(" "); //$NON-NLS-1$ } needsSeparator = true; final boolean isDefaultValued = annotationFinder.findAnnotation(parameter, DefaultValue.class) != null; final Styler styler; if (isDefaultValued) { styler = OPTIONAL_ELEMENT_STYLER; result.append(keywords.getLeftSquareBracketKeyword(), styler); } else { styler = null; } if (includeName) { result.append(parameter.getName(), styler).append(" ", styler); //$NON-NLS-1$ result.append(keywords.getColonKeyword(), styler).append(" ", styler); //$NON-NLS-1$ } JvmTypeReference typeRef = parameter.getParameterType(); if (isVarArgs && !iterator.hasNext() && typeRef instanceof JvmGenericArrayTypeReference) { typeRef = ((JvmGenericArrayTypeReference) typeRef).getComponentType(); result.append(utils.referenceToString(typeRef, NULL_TYPE), styler); result.append(keywords.getWildcardAsteriskKeyword(), styler); } else { result.append(utils.referenceToString(typeRef, NULL_TYPE), styler); } if (isDefaultValued) { result.append(keywords.getRightSquareBracketKeyword(), styler); } } return result; }
Example #3
Source File: AbstractSARLUiModule.java From sarl with Apache License 2.0 | 4 votes |
public Class<? extends UIStrings> bindUIStrings() { return SARLUIStrings.class; }