Java Code Examples for org.eclipse.xtext.common.types.JvmField#getSimpleName()
The following examples show how to use
org.eclipse.xtext.common.types.JvmField#getSimpleName() .
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: XtendValidator.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
@Check public void checkLocalUsageOfDeclaredFields(XtendField field){ if(doCheckValidMemberName(field) && !isIgnored(UNUSED_PRIVATE_MEMBER)) { JvmField jvmField = associations.getJvmField(field); if (jvmField == null || jvmField.getVisibility() != JvmVisibility.PRIVATE || jvmField.eContainer() == null) return; if (isLocallyUsed(jvmField, getOutermostType(field))) return; String message; if(field.isExtension()) { if(field.getName() == null && jvmField.getType() != null) message = "The extension " + jvmField.getType().getIdentifier() + " is not used in " + getDeclaratorName(jvmField); else message = "The extension " + getDeclaratorName(jvmField) + "." + jvmField.getSimpleName() + " is not used"; } else { message = "The value of the field " + getDeclaratorName(jvmField) + "." + jvmField.getSimpleName() + " is not used"; } addIssueToState(UNUSED_PRIVATE_MEMBER, message, XtendPackage.Literals.XTEND_FIELD__NAME); } }
Example 2
Source File: XbaseDeclarativeHoverSignatureProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
protected String _signature(JvmField jvmField, boolean typeAtEnd) { JvmTypeReference type = jvmField.getType(); if (type != null) { String signature = jvmField.getSimpleName(); if (typeAtEnd) return signature + " : " + type.getSimpleName(); return type.getSimpleName() + " " + enrichWithDeclarator(signature, jvmField); } return ""; }
Example 3
Source File: XtendJvmLabelProvider.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Override protected Object text(final JvmField element) { String _simpleName = element.getSimpleName(); StyledString _styledString = new StyledString(_simpleName); String _simpleName_1 = element.getType().getSimpleName(); String _plus = (" : " + _simpleName_1); StyledString _styledString_1 = new StyledString(_plus, StyledString.DECORATIONS_STYLER); return _styledString.append(_styledString_1); }
Example 4
Source File: ConstantExpressionsInterpreter.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
protected Object evaluateField(final XAbstractFeatureCall call, final JvmField field, final Context context) { if ((field.isSetConstant() || (field.eResource() instanceof TypeResource))) { boolean _isConstant = field.isConstant(); if (_isConstant) { return field.getConstantValue(); } else { String _simpleName = field.getDeclaringType().getSimpleName(); String _plus = ("Field " + _simpleName); String _plus_1 = (_plus + "."); String _simpleName_1 = field.getSimpleName(); String _plus_2 = (_plus_1 + _simpleName_1); String _plus_3 = (_plus_2 + " is not a constant"); throw new ConstantExpressionEvaluationException(_plus_3); } } final XExpression expression = this.containerProvider.getAssociatedExpression(field); boolean _contains = context.getAlreadyEvaluating().contains(expression); if (_contains) { throw new ConstantExpressionEvaluationException("Endless recursive evaluation detected."); } try { final Map<String, JvmIdentifiableElement> visibleFeatures = this.findVisibleFeatures(expression); JvmTypeReference _type = field.getType(); ClassFinder _classFinder = context.getClassFinder(); Set<XExpression> _alreadyEvaluating = context.getAlreadyEvaluating(); final Context ctx = new Context(_type, _classFinder, visibleFeatures, _alreadyEvaluating); return this.evaluate(expression, ctx); } catch (final Throwable _t) { if (_t instanceof ConstantExpressionEvaluationException) { final ConstantExpressionEvaluationException e = (ConstantExpressionEvaluationException)_t; throw new StackedConstantExpressionEvaluationException(call, field, e); } else { throw Exceptions.sneakyThrow(_t); } } }
Example 5
Source File: StackedConstantExpressionEvaluationException.java From xtext-extras with Eclipse Public License 2.0 | 4 votes |
public StackedConstantExpressionEvaluationException(XExpression expression, JvmField field, ConstantExpressionEvaluationException cause) { super("Error during call to " + field.getSimpleName() + " : " + cause.getMessage(), expression, cause); }
Example 6
Source File: XbaseLabelProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
protected Object text(JvmField field) { return field.getSimpleName() + " : " + field.getType().getSimpleName(); }