Search in sources :

Example 11 with XImportDeclaration

use of org.eclipse.xtext.xtype.XImportDeclaration in project dsl-devkit by dsldevkit.

the class AbstractCheckSemanticSequencer method sequence.

@Override
public void sequence(ISerializationContext context, EObject semanticObject) {
    EPackage epackage = semanticObject.eClass().getEPackage();
    ParserRule rule = context.getParserRule();
    Action action = context.getAssignedAction();
    Set<Parameter> parameters = context.getEnabledBooleanParameters();
    if (epackage == CheckPackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case CheckPackage.CATEGORY:
                sequence_Category(context, (Category) semanticObject);
                return;
            case CheckPackage.CHECK:
                sequence_Check(context, (Check) semanticObject);
                return;
            case CheckPackage.CHECK_CATALOG:
                sequence_CheckCatalog(context, (CheckCatalog) semanticObject);
                return;
            case CheckPackage.CONTEXT:
                sequence_Context(context, (Context) semanticObject);
                return;
            case CheckPackage.CONTEXT_VARIABLE:
                sequence_ContextVariable(context, (ContextVariable) semanticObject);
                return;
            case CheckPackage.FORMAL_PARAMETER:
                sequence_FormalParameter(context, (FormalParameter) semanticObject);
                return;
            case CheckPackage.IMPLEMENTATION:
                sequence_Implementation(context, (Implementation) semanticObject);
                return;
            case CheckPackage.MEMBER:
                sequence_Member(context, (Member) semanticObject);
                return;
            case CheckPackage.SEVERITY_RANGE:
                sequence_SeverityRange(context, (SeverityRange) semanticObject);
                return;
            case CheckPackage.XGUARD_EXPRESSION:
                sequence_XGuardExpression(context, (XGuardExpression) semanticObject);
                return;
            case CheckPackage.XISSUE_EXPRESSION:
                sequence_XIssueExpression(context, (XIssueExpression) semanticObject);
                return;
        }
    else if (epackage == TypesPackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case TypesPackage.JVM_FORMAL_PARAMETER:
                if (rule == grammarAccess.getFullJvmFormalParameterRule()) {
                    sequence_FullJvmFormalParameter(context, (JvmFormalParameter) semanticObject);
                    return;
                } else if (rule == grammarAccess.getJvmFormalParameterRule()) {
                    sequence_JvmFormalParameter(context, (JvmFormalParameter) semanticObject);
                    return;
                } else
                    break;
            case TypesPackage.JVM_GENERIC_ARRAY_TYPE_REFERENCE:
                sequence_JvmTypeReference(context, (JvmGenericArrayTypeReference) semanticObject);
                return;
            case TypesPackage.JVM_INNER_TYPE_REFERENCE:
                sequence_JvmParameterizedTypeReference(context, (JvmInnerTypeReference) semanticObject);
                return;
            case TypesPackage.JVM_LOWER_BOUND:
                if (rule == grammarAccess.getJvmLowerBoundAndedRule()) {
                    sequence_JvmLowerBoundAnded(context, (JvmLowerBound) semanticObject);
                    return;
                } else if (rule == grammarAccess.getJvmLowerBoundRule()) {
                    sequence_JvmLowerBound(context, (JvmLowerBound) semanticObject);
                    return;
                } else
                    break;
            case TypesPackage.JVM_PARAMETERIZED_TYPE_REFERENCE:
                if (action == grammarAccess.getJvmParameterizedTypeReferenceAccess().getJvmInnerTypeReferenceOuterAction_1_4_0_0_0()) {
                    sequence_JvmParameterizedTypeReference_JvmInnerTypeReference_1_4_0_0_0(context, (JvmParameterizedTypeReference) semanticObject);
                    return;
                } else if (rule == grammarAccess.getJvmTypeReferenceRule() || action == grammarAccess.getJvmTypeReferenceAccess().getJvmGenericArrayTypeReferenceComponentTypeAction_0_1_0_0() || rule == grammarAccess.getJvmParameterizedTypeReferenceRule() || rule == grammarAccess.getJvmArgumentTypeReferenceRule()) {
                    sequence_JvmParameterizedTypeReference(context, (JvmParameterizedTypeReference) semanticObject);
                    return;
                } else
                    break;
            case TypesPackage.JVM_TYPE_PARAMETER:
                sequence_JvmTypeParameter(context, (JvmTypeParameter) semanticObject);
                return;
            case TypesPackage.JVM_UPPER_BOUND:
                if (rule == grammarAccess.getJvmUpperBoundAndedRule()) {
                    sequence_JvmUpperBoundAnded(context, (JvmUpperBound) semanticObject);
                    return;
                } else if (rule == grammarAccess.getJvmUpperBoundRule()) {
                    sequence_JvmUpperBound(context, (JvmUpperBound) semanticObject);
                    return;
                } else
                    break;
            case TypesPackage.JVM_WILDCARD_TYPE_REFERENCE:
                sequence_JvmWildcardTypeReference(context, (JvmWildcardTypeReference) semanticObject);
                return;
        }
    else if (epackage == XAnnotationsPackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case XAnnotationsPackage.XANNOTATION:
                sequence_XAnnotation(context, (XAnnotation) semanticObject);
                return;
            case XAnnotationsPackage.XANNOTATION_ELEMENT_VALUE_PAIR:
                sequence_XAnnotationElementValuePair(context, (XAnnotationElementValuePair) semanticObject);
                return;
        }
    else if (epackage == XbasePackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case XbasePackage.XASSIGNMENT:
                sequence_XAssignment_XMemberFeatureCall(context, (XAssignment) semanticObject);
                return;
            case XbasePackage.XBASIC_FOR_LOOP_EXPRESSION:
                sequence_XBasicForLoopExpression(context, (XBasicForLoopExpression) semanticObject);
                return;
            case XbasePackage.XBINARY_OPERATION:
                sequence_XAdditiveExpression_XAndExpression_XAssignment_XEqualityExpression_XMultiplicativeExpression_XOrExpression_XOtherOperatorExpression_XRelationalExpression(context, (XBinaryOperation) semanticObject);
                return;
            case XbasePackage.XBLOCK_EXPRESSION:
                if (rule == grammarAccess.getXPrimaryExpressionRule() || rule == grammarAccess.getXAnnotationElementValueOrCommaListRule() || action == grammarAccess.getXAnnotationElementValueOrCommaListAccess().getXListLiteralElementsAction_1_1_0() || rule == grammarAccess.getXAnnotationElementValueRule() || rule == grammarAccess.getXAnnotationOrExpressionRule() || rule == grammarAccess.getXExpressionRule() || rule == grammarAccess.getXAssignmentRule() || action == grammarAccess.getXAssignmentAccess().getXBinaryOperationLeftOperandAction_1_1_0_0_0() || rule == grammarAccess.getXOrExpressionRule() || action == grammarAccess.getXOrExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXAndExpressionRule() || action == grammarAccess.getXAndExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXEqualityExpressionRule() || action == grammarAccess.getXEqualityExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXRelationalExpressionRule() || action == grammarAccess.getXRelationalExpressionAccess().getXInstanceOfExpressionExpressionAction_1_0_0_0_0() || action == grammarAccess.getXRelationalExpressionAccess().getXBinaryOperationLeftOperandAction_1_1_0_0_0() || rule == grammarAccess.getXOtherOperatorExpressionRule() || action == grammarAccess.getXOtherOperatorExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXAdditiveExpressionRule() || action == grammarAccess.getXAdditiveExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXMultiplicativeExpressionRule() || action == grammarAccess.getXMultiplicativeExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXUnaryOperationRule() || rule == grammarAccess.getXCastedExpressionRule() || action == grammarAccess.getXCastedExpressionAccess().getXCastedExpressionTargetAction_1_0_0_0() || rule == grammarAccess.getXPostfixOperationRule() || action == grammarAccess.getXPostfixOperationAccess().getXPostfixOperationOperandAction_1_0_0() || rule == grammarAccess.getXMemberFeatureCallRule() || action == grammarAccess.getXMemberFeatureCallAccess().getXAssignmentAssignableAction_1_0_0_0_0() || action == grammarAccess.getXMemberFeatureCallAccess().getXMemberFeatureCallMemberCallTargetAction_1_1_0_0_0() || rule == grammarAccess.getXParenthesizedExpressionRule() || rule == grammarAccess.getXBlockExpressionRule() || rule == grammarAccess.getXExpressionOrVarDeclarationRule()) {
                    sequence_XBlockExpression(context, (XBlockExpression) semanticObject);
                    return;
                } else if (rule == grammarAccess.getXExpressionInClosureRule()) {
                    sequence_XExpressionInClosure(context, (XBlockExpression) semanticObject);
                    return;
                } else
                    break;
            case XbasePackage.XBOOLEAN_LITERAL:
                sequence_XBooleanLiteral(context, (XBooleanLiteral) semanticObject);
                return;
            case XbasePackage.XCASE_PART:
                sequence_XCasePart(context, (XCasePart) semanticObject);
                return;
            case XbasePackage.XCASTED_EXPRESSION:
                sequence_XCastedExpression(context, (XCastedExpression) semanticObject);
                return;
            case XbasePackage.XCATCH_CLAUSE:
                sequence_XCatchClause(context, (XCatchClause) semanticObject);
                return;
            case XbasePackage.XCLOSURE:
                if (rule == grammarAccess.getXPrimaryExpressionRule() || rule == grammarAccess.getXAnnotationElementValueOrCommaListRule() || action == grammarAccess.getXAnnotationElementValueOrCommaListAccess().getXListLiteralElementsAction_1_1_0() || rule == grammarAccess.getXAnnotationElementValueRule() || rule == grammarAccess.getXAnnotationOrExpressionRule() || rule == grammarAccess.getXExpressionRule() || rule == grammarAccess.getXAssignmentRule() || action == grammarAccess.getXAssignmentAccess().getXBinaryOperationLeftOperandAction_1_1_0_0_0() || rule == grammarAccess.getXOrExpressionRule() || action == grammarAccess.getXOrExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXAndExpressionRule() || action == grammarAccess.getXAndExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXEqualityExpressionRule() || action == grammarAccess.getXEqualityExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXRelationalExpressionRule() || action == grammarAccess.getXRelationalExpressionAccess().getXInstanceOfExpressionExpressionAction_1_0_0_0_0() || action == grammarAccess.getXRelationalExpressionAccess().getXBinaryOperationLeftOperandAction_1_1_0_0_0() || rule == grammarAccess.getXOtherOperatorExpressionRule() || action == grammarAccess.getXOtherOperatorExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXAdditiveExpressionRule() || action == grammarAccess.getXAdditiveExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXMultiplicativeExpressionRule() || action == grammarAccess.getXMultiplicativeExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXUnaryOperationRule() || rule == grammarAccess.getXCastedExpressionRule() || action == grammarAccess.getXCastedExpressionAccess().getXCastedExpressionTargetAction_1_0_0_0() || rule == grammarAccess.getXPostfixOperationRule() || action == grammarAccess.getXPostfixOperationAccess().getXPostfixOperationOperandAction_1_0_0() || rule == grammarAccess.getXMemberFeatureCallRule() || action == grammarAccess.getXMemberFeatureCallAccess().getXAssignmentAssignableAction_1_0_0_0_0() || action == grammarAccess.getXMemberFeatureCallAccess().getXMemberFeatureCallMemberCallTargetAction_1_1_0_0_0() || rule == grammarAccess.getXLiteralRule() || rule == grammarAccess.getXClosureRule() || rule == grammarAccess.getXParenthesizedExpressionRule() || rule == grammarAccess.getXExpressionOrVarDeclarationRule()) {
                    sequence_XClosure(context, (XClosure) semanticObject);
                    return;
                } else if (rule == grammarAccess.getXShortClosureRule()) {
                    sequence_XShortClosure(context, (XClosure) semanticObject);
                    return;
                } else
                    break;
            case XbasePackage.XCONSTRUCTOR_CALL:
                sequence_XConstructorCall(context, (XConstructorCall) semanticObject);
                return;
            case XbasePackage.XDO_WHILE_EXPRESSION:
                sequence_XDoWhileExpression(context, (XDoWhileExpression) semanticObject);
                return;
            case XbasePackage.XFEATURE_CALL:
                sequence_XFeatureCall(context, (XFeatureCall) semanticObject);
                return;
            case XbasePackage.XFOR_LOOP_EXPRESSION:
                sequence_XForLoopExpression(context, (XForLoopExpression) semanticObject);
                return;
            case XbasePackage.XIF_EXPRESSION:
                sequence_XIfExpression(context, (XIfExpression) semanticObject);
                return;
            case XbasePackage.XINSTANCE_OF_EXPRESSION:
                sequence_XRelationalExpression(context, (XInstanceOfExpression) semanticObject);
                return;
            case XbasePackage.XLIST_LITERAL:
                if (rule == grammarAccess.getXAnnotationElementValueOrCommaListRule()) {
                    sequence_XAnnotationElementValueOrCommaList_XListLiteral(context, (XListLiteral) semanticObject);
                    return;
                } else if (rule == grammarAccess.getXAnnotationElementValueRule()) {
                    sequence_XAnnotationElementValue_XListLiteral(context, (XListLiteral) semanticObject);
                    return;
                } else if (rule == grammarAccess.getXFormalParameterDefaultValueLiteralRule() || rule == grammarAccess.getXConstantListLiteralRule()) {
                    sequence_XConstantListLiteral(context, (XListLiteral) semanticObject);
                    return;
                } else if (rule == grammarAccess.getXPrimaryExpressionRule() || action == grammarAccess.getXAnnotationElementValueOrCommaListAccess().getXListLiteralElementsAction_1_1_0() || rule == grammarAccess.getXAnnotationOrExpressionRule() || rule == grammarAccess.getXExpressionRule() || rule == grammarAccess.getXAssignmentRule() || action == grammarAccess.getXAssignmentAccess().getXBinaryOperationLeftOperandAction_1_1_0_0_0() || rule == grammarAccess.getXOrExpressionRule() || action == grammarAccess.getXOrExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXAndExpressionRule() || action == grammarAccess.getXAndExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXEqualityExpressionRule() || action == grammarAccess.getXEqualityExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXRelationalExpressionRule() || action == grammarAccess.getXRelationalExpressionAccess().getXInstanceOfExpressionExpressionAction_1_0_0_0_0() || action == grammarAccess.getXRelationalExpressionAccess().getXBinaryOperationLeftOperandAction_1_1_0_0_0() || rule == grammarAccess.getXOtherOperatorExpressionRule() || action == grammarAccess.getXOtherOperatorExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXAdditiveExpressionRule() || action == grammarAccess.getXAdditiveExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXMultiplicativeExpressionRule() || action == grammarAccess.getXMultiplicativeExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXUnaryOperationRule() || rule == grammarAccess.getXCastedExpressionRule() || action == grammarAccess.getXCastedExpressionAccess().getXCastedExpressionTargetAction_1_0_0_0() || rule == grammarAccess.getXPostfixOperationRule() || action == grammarAccess.getXPostfixOperationAccess().getXPostfixOperationOperandAction_1_0_0() || rule == grammarAccess.getXMemberFeatureCallRule() || action == grammarAccess.getXMemberFeatureCallAccess().getXAssignmentAssignableAction_1_0_0_0_0() || action == grammarAccess.getXMemberFeatureCallAccess().getXMemberFeatureCallMemberCallTargetAction_1_1_0_0_0() || rule == grammarAccess.getXLiteralRule() || rule == grammarAccess.getXCollectionLiteralRule() || rule == grammarAccess.getXListLiteralRule() || rule == grammarAccess.getXParenthesizedExpressionRule() || rule == grammarAccess.getXExpressionOrVarDeclarationRule()) {
                    sequence_XListLiteral(context, (XListLiteral) semanticObject);
                    return;
                } else
                    break;
            case XbasePackage.XMEMBER_FEATURE_CALL:
                sequence_XMemberFeatureCall(context, (XMemberFeatureCall) semanticObject);
                return;
            case XbasePackage.XNULL_LITERAL:
                sequence_XNullLiteral(context, (XNullLiteral) semanticObject);
                return;
            case XbasePackage.XNUMBER_LITERAL:
                sequence_XNumberLiteral(context, (XNumberLiteral) semanticObject);
                return;
            case XbasePackage.XPOSTFIX_OPERATION:
                sequence_XPostfixOperation(context, (XPostfixOperation) semanticObject);
                return;
            case XbasePackage.XRETURN_EXPRESSION:
                sequence_XReturnExpression(context, (XReturnExpression) semanticObject);
                return;
            case XbasePackage.XSET_LITERAL:
                sequence_XSetLiteral(context, (XSetLiteral) semanticObject);
                return;
            case XbasePackage.XSTRING_LITERAL:
                sequence_XStringLiteral(context, (XStringLiteral) semanticObject);
                return;
            case XbasePackage.XSWITCH_EXPRESSION:
                sequence_XSwitchExpression(context, (XSwitchExpression) semanticObject);
                return;
            case XbasePackage.XSYNCHRONIZED_EXPRESSION:
                sequence_XSynchronizedExpression(context, (XSynchronizedExpression) semanticObject);
                return;
            case XbasePackage.XTHROW_EXPRESSION:
                sequence_XThrowExpression(context, (XThrowExpression) semanticObject);
                return;
            case XbasePackage.XTRY_CATCH_FINALLY_EXPRESSION:
                sequence_XTryCatchFinallyExpression(context, (XTryCatchFinallyExpression) semanticObject);
                return;
            case XbasePackage.XTYPE_LITERAL:
                sequence_XTypeLiteral(context, (XTypeLiteral) semanticObject);
                return;
            case XbasePackage.XUNARY_OPERATION:
                if (rule == grammarAccess.getXConstantUnaryOperationRule() || rule == grammarAccess.getXFormalParameterDefaultValueLiteralRule()) {
                    sequence_XConstantUnaryOperation(context, (XUnaryOperation) semanticObject);
                    return;
                } else if (rule == grammarAccess.getXPrimaryExpressionRule() || rule == grammarAccess.getXAnnotationElementValueOrCommaListRule() || action == grammarAccess.getXAnnotationElementValueOrCommaListAccess().getXListLiteralElementsAction_1_1_0() || rule == grammarAccess.getXAnnotationElementValueRule() || rule == grammarAccess.getXAnnotationOrExpressionRule() || rule == grammarAccess.getXExpressionRule() || rule == grammarAccess.getXAssignmentRule() || action == grammarAccess.getXAssignmentAccess().getXBinaryOperationLeftOperandAction_1_1_0_0_0() || rule == grammarAccess.getXOrExpressionRule() || action == grammarAccess.getXOrExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXAndExpressionRule() || action == grammarAccess.getXAndExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXEqualityExpressionRule() || action == grammarAccess.getXEqualityExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXRelationalExpressionRule() || action == grammarAccess.getXRelationalExpressionAccess().getXInstanceOfExpressionExpressionAction_1_0_0_0_0() || action == grammarAccess.getXRelationalExpressionAccess().getXBinaryOperationLeftOperandAction_1_1_0_0_0() || rule == grammarAccess.getXOtherOperatorExpressionRule() || action == grammarAccess.getXOtherOperatorExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXAdditiveExpressionRule() || action == grammarAccess.getXAdditiveExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXMultiplicativeExpressionRule() || action == grammarAccess.getXMultiplicativeExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXUnaryOperationRule() || rule == grammarAccess.getXCastedExpressionRule() || action == grammarAccess.getXCastedExpressionAccess().getXCastedExpressionTargetAction_1_0_0_0() || rule == grammarAccess.getXPostfixOperationRule() || action == grammarAccess.getXPostfixOperationAccess().getXPostfixOperationOperandAction_1_0_0() || rule == grammarAccess.getXMemberFeatureCallRule() || action == grammarAccess.getXMemberFeatureCallAccess().getXAssignmentAssignableAction_1_0_0_0_0() || action == grammarAccess.getXMemberFeatureCallAccess().getXMemberFeatureCallMemberCallTargetAction_1_1_0_0_0() || rule == grammarAccess.getXParenthesizedExpressionRule() || rule == grammarAccess.getXExpressionOrVarDeclarationRule()) {
                    sequence_XUnaryOperation(context, (XUnaryOperation) semanticObject);
                    return;
                } else
                    break;
            case XbasePackage.XVARIABLE_DECLARATION:
                sequence_XVariableDeclaration(context, (XVariableDeclaration) semanticObject);
                return;
            case XbasePackage.XWHILE_EXPRESSION:
                sequence_XWhileExpression(context, (XWhileExpression) semanticObject);
                return;
        }
    else if (epackage == XtypePackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case XtypePackage.XFUNCTION_TYPE_REF:
                sequence_XFunctionTypeRef(context, (XFunctionTypeRef) semanticObject);
                return;
            case XtypePackage.XIMPORT_DECLARATION:
                sequence_XImportDeclaration(context, (XImportDeclaration) semanticObject);
                return;
            case XtypePackage.XIMPORT_SECTION:
                sequence_XImportSection(context, (XImportSection) semanticObject);
                return;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : ParserRule(org.eclipse.xtext.ParserRule) XAnnotationElementValuePair(org.eclipse.xtext.xbase.annotations.xAnnotations.XAnnotationElementValuePair) Action(org.eclipse.xtext.Action) Category(com.avaloq.tools.ddk.check.check.Category) XFunctionTypeRef(org.eclipse.xtext.xtype.XFunctionTypeRef) XClosure(org.eclipse.xtext.xbase.XClosure) XImportSection(org.eclipse.xtext.xtype.XImportSection) ContextVariable(com.avaloq.tools.ddk.check.check.ContextVariable) Check(com.avaloq.tools.ddk.check.check.Check) XListLiteral(org.eclipse.xtext.xbase.XListLiteral) Implementation(com.avaloq.tools.ddk.check.check.Implementation) EPackage(org.eclipse.emf.ecore.EPackage) XAnnotation(org.eclipse.xtext.xbase.annotations.xAnnotations.XAnnotation) CheckCatalog(com.avaloq.tools.ddk.check.check.CheckCatalog) Member(com.avaloq.tools.ddk.check.check.Member) ISerializationContext(org.eclipse.xtext.serializer.ISerializationContext) Context(com.avaloq.tools.ddk.check.check.Context) FormalParameter(com.avaloq.tools.ddk.check.check.FormalParameter) JvmFormalParameter(org.eclipse.xtext.common.types.JvmFormalParameter) XBlockExpression(org.eclipse.xtext.xbase.XBlockExpression) XGuardExpression(com.avaloq.tools.ddk.check.check.XGuardExpression) JvmLowerBound(org.eclipse.xtext.common.types.JvmLowerBound) SeverityRange(com.avaloq.tools.ddk.check.check.SeverityRange) XImportDeclaration(org.eclipse.xtext.xtype.XImportDeclaration) JvmUpperBound(org.eclipse.xtext.common.types.JvmUpperBound) XIssueExpression(com.avaloq.tools.ddk.check.check.XIssueExpression) JvmFormalParameter(org.eclipse.xtext.common.types.JvmFormalParameter) XUnaryOperation(org.eclipse.xtext.xbase.XUnaryOperation) FormalParameter(com.avaloq.tools.ddk.check.check.FormalParameter) JvmFormalParameter(org.eclipse.xtext.common.types.JvmFormalParameter) JvmTypeParameter(org.eclipse.xtext.common.types.JvmTypeParameter) Parameter(org.eclipse.xtext.Parameter) JvmParameterizedTypeReference(org.eclipse.xtext.common.types.JvmParameterizedTypeReference)

Example 12 with XImportDeclaration

use of org.eclipse.xtext.xtype.XImportDeclaration in project xtext-extras by eclipse.

the class RewritableImportSection method update.

public void update() {
    XImportSection importSection = importsConfiguration.getImportSection(resource);
    if (importSection == null && importsConfiguration instanceof IMutableImportsConfiguration) {
        importSection = XtypeFactory.eINSTANCE.createXImportSection();
        IMutableImportsConfiguration mutableImportsConfiguration = (IMutableImportsConfiguration) importsConfiguration;
        mutableImportsConfiguration.setImportSection(resource, importSection);
    }
    if (importSection == null) {
        return;
    }
    removeObsoleteStaticImports();
    List<XImportDeclaration> allImportDeclarations = newArrayList();
    allImportDeclarations.addAll(originalImportDeclarations);
    allImportDeclarations.addAll(addedImportDeclarations);
    allImportDeclarations.removeAll(removedImportDeclarations);
    List<XImportDeclaration> importDeclarations = importSection.getImportDeclarations();
    importDeclarations.clear();
    importDeclarations.addAll(allImportDeclarations);
}
Also used : XImportSection(org.eclipse.xtext.xtype.XImportSection) XImportDeclaration(org.eclipse.xtext.xtype.XImportDeclaration)

Example 13 with XImportDeclaration

use of org.eclipse.xtext.xtype.XImportDeclaration in project xtext-extras by eclipse.

the class RewritableImportSection method removeImport.

public boolean removeImport(JvmDeclaredType type) {
    List<XImportDeclaration> addedImportDeclarationsToRemove = findOriginalImports(type, null, addedImportDeclarations, false, false);
    addedImportDeclarations.removeAll(addedImportDeclarationsToRemove);
    List<XImportDeclaration> originalImportDeclarationsToRemove = findOriginalImports(type, null, originalImportDeclarations, false, false);
    removedImportDeclarations.addAll(originalImportDeclarationsToRemove);
    for (Map.Entry<String, List<JvmDeclaredType>> entry : plainImports.entrySet()) {
        List<JvmDeclaredType> values = entry.getValue();
        if (values.size() == 1) {
            if (values.get(0) == type) {
                plainImports.remove(type.getSimpleName());
                return true;
            }
        }
        Iterator<JvmDeclaredType> iterator = values.iterator();
        while (iterator.hasNext()) {
            JvmDeclaredType value = iterator.next();
            if (value == type) {
                iterator.remove();
                return true;
            }
        }
    }
    return false;
}
Also used : JvmDeclaredType(org.eclipse.xtext.common.types.JvmDeclaredType) List(java.util.List) Map(java.util.Map) XImportDeclaration(org.eclipse.xtext.xtype.XImportDeclaration)

Example 14 with XImportDeclaration

use of org.eclipse.xtext.xtype.XImportDeclaration in project xtext-extras by eclipse.

the class RewritableImportSection method addStaticExtensionImport.

/**
 * @param typeFqn
 *            The fully qualified name of the type to import. E.g. <code>java.util.List</code>. May not be
 *            <code>null</code>.
 * @param member
 *            member name to import. May not be <code>null</code>. For wildcard use <code>*</code>
 */
public boolean addStaticExtensionImport(final String typeFqn, final String member) {
    if (typeFqn == null || member == null) {
        throw new IllegalArgumentException("Type name " + typeFqn + ". Member name: " + member);
    }
    if (hasStaticImport(typeFqn, member, true)) {
        return false;
    }
    XImportDeclaration importDecl = createImport(typeFqn, member);
    importDecl.setStatic(true);
    importDecl.setExtension(true);
    return addedImportDeclarations.add(importDecl);
}
Also used : XImportDeclaration(org.eclipse.xtext.xtype.XImportDeclaration)

Example 15 with XImportDeclaration

use of org.eclipse.xtext.xtype.XImportDeclaration in project xtext-extras by eclipse.

the class RewritableImportSection method addStaticImport.

public boolean addStaticImport(JvmDeclaredType type, String memberName) {
    if (hasStaticImport(staticImports, type, memberName)) {
        return false;
    }
    Maps2.putIntoSetMap(type, memberName, staticImports);
    XImportDeclaration importDeclaration = XtypeFactory.eINSTANCE.createXImportDeclaration();
    importDeclaration.setImportedType(type);
    importDeclaration.setStatic(true);
    if (memberName == null) {
        importDeclaration.setWildcard(true);
    } else {
        importDeclaration.setMemberName(memberName);
    }
    addedImportDeclarations.add(importDeclaration);
    return true;
}
Also used : XImportDeclaration(org.eclipse.xtext.xtype.XImportDeclaration)

Aggregations

XImportDeclaration (org.eclipse.xtext.xtype.XImportDeclaration)34 JvmDeclaredType (org.eclipse.xtext.common.types.JvmDeclaredType)8 XImportSection (org.eclipse.xtext.xtype.XImportSection)8 JvmType (org.eclipse.xtext.common.types.JvmType)6 JvmTypeParameter (org.eclipse.xtext.common.types.JvmTypeParameter)6 Test (org.junit.Test)6 JvmParameterizedTypeReference (org.eclipse.xtext.common.types.JvmParameterizedTypeReference)5 EObject (org.eclipse.emf.ecore.EObject)4 EPackage (org.eclipse.emf.ecore.EPackage)4 Action (org.eclipse.xtext.Action)4 Parameter (org.eclipse.xtext.Parameter)4 ParserRule (org.eclipse.xtext.ParserRule)4 JvmLowerBound (org.eclipse.xtext.common.types.JvmLowerBound)4 JvmUpperBound (org.eclipse.xtext.common.types.JvmUpperBound)4 ITextRegion (org.eclipse.xtext.util.ITextRegion)4 XBlockExpression (org.eclipse.xtext.xbase.XBlockExpression)4 XClosure (org.eclipse.xtext.xbase.XClosure)4 XFunctionTypeRef (org.eclipse.xtext.xtype.XFunctionTypeRef)4 JvmFormalParameter (org.eclipse.xtext.common.types.JvmFormalParameter)3 List (java.util.List)2