Java Code Examples for org.eclipse.xtext.xbase.XFeatureCall#getConcreteSyntaxFeatureName()
The following examples show how to use
org.eclipse.xtext.xbase.XFeatureCall#getConcreteSyntaxFeatureName() .
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: SARLExpressionHelper.java From sarl with Apache License 2.0 | 6 votes |
/** Convert the boolean constant to the object equivalent if possible. * * @param expression the expression to convert. * @return one of the boolean constants {@link Boolean#TRUE} or {@link Boolean#FALSE}, * or {@code null} if the expression is not a constant boolean expression. */ @SuppressWarnings("static-method") public Boolean toBooleanPrimitiveWrapperConstant(XExpression expression) { if (expression instanceof XBooleanLiteral) { return ((XBooleanLiteral) expression).isIsTrue() ? Boolean.TRUE : Boolean.FALSE; } if (expression instanceof XMemberFeatureCall) { final XMemberFeatureCall call = (XMemberFeatureCall) expression; final XExpression receiver = call.getMemberCallTarget(); if (receiver instanceof XFeatureCall) { final XFeatureCall call2 = (XFeatureCall) receiver; final String call2Identifier = call2.getConcreteSyntaxFeatureName(); if (Boolean.class.getSimpleName().equals(call2Identifier) || Boolean.class.getName().equals(call2Identifier)) { final String callIdentifier = call.getConcreteSyntaxFeatureName(); if ("TRUE".equals(callIdentifier)) { //$NON-NLS-1$ return Boolean.TRUE; } else if ("FALSE".equals(callIdentifier)) { //$NON-NLS-1$ return Boolean.FALSE; } } } } return null; }
Example 2
Source File: UTF8ParserErrorTest.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Test public void testInvalidReference_01() throws Exception { XtendFunction func = function("def m() { \\u0020invalidStart }"); XBlockExpression block = (XBlockExpression) func.getExpression(); XFeatureCall featureCall = (XFeatureCall) block.getExpressions().get(0); String featureName = featureCall.getConcreteSyntaxFeatureName(); assertEquals("\\u0020invalidStart", featureName); assertTrue(featureCall.getFeature().eIsProxy()); List<Diagnostic> errorList = func.eResource().getErrors(); assertEquals(2, errorList.size()); XtextLinkingDiagnostic diagnostic = (XtextLinkingDiagnostic) errorList.get(1); assertTrue(diagnostic.getMessage().contains("invalidStart")); }
Example 3
Source File: UTF8ParserErrorTest.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Test public void testInvalidReference_02() throws Exception { XtendFunction func = function("def m() { invalid\\u0020Part }"); XBlockExpression block = (XBlockExpression) func.getExpression(); XFeatureCall featureCall = (XFeatureCall) block.getExpressions().get(0); String featureName = featureCall.getConcreteSyntaxFeatureName(); assertEquals("invalid\\u0020Part", featureName); assertTrue(featureCall.getFeature().eIsProxy()); List<Diagnostic> errorList = func.eResource().getErrors(); assertEquals(2, errorList.size()); XtextLinkingDiagnostic diagnostic = (XtextLinkingDiagnostic) errorList.get(1); assertTrue(diagnostic.getMessage().contains("invalidPart")); }
Example 4
Source File: ConstantExpressionsInterpreter.java From xtext-xtend with Eclipse Public License 2.0 | 4 votes |
protected String _getFullName(final XFeatureCall call) { return call.getConcreteSyntaxFeatureName(); }