Search in sources :

Example 6 with ExportModel

use of com.avaloq.tools.ddk.xtext.export.export.ExportModel in project dsl-devkit by dsldevkit.

the class ExportScopingTest method testEAttributeScope.

@Test
public void testEAttributeScope() throws IOException {
    ExportModel model = (ExportModel) getTestSource().getModel();
    IScope scope = scopeProvider.scope_EAttribute(model.getInterfaces().get(0), null);
    // CHECKSTYLE:OFF (DuplicateString)
    assertNotNull("Could not locate EStructuralFeature.", scope.getSingleElement(QualifiedName.create("unordered")));
    assertNull("Located non-existent EStructuralFeature.", scope.getSingleElement(QualifiedName.create("expr")));
// CHECKSTYLE:ON
}
Also used : ExportModel(com.avaloq.tools.ddk.xtext.export.export.ExportModel) IScope(org.eclipse.xtext.scoping.IScope) AbstractScopingTest(com.avaloq.tools.ddk.xtext.test.scoping.AbstractScopingTest) Test(org.junit.Test)

Example 7 with ExportModel

use of com.avaloq.tools.ddk.xtext.export.export.ExportModel in project dsl-devkit by dsldevkit.

the class ExportScopingTest method testInterfaceNavigationRefScope.

@Test
public void testInterfaceNavigationRefScope() throws IOException {
    ExportModel model = (ExportModel) getTestSource().getModel();
    IScope scope = scopeProvider.scope_InterfaceNavigation_ref(model.getInterfaces().get(0), null);
    // CHECKSTYLE:OFF (DuplicateString)
    assertNotNull("Could not locate InterfaceNavigationRef.", scope.getSingleElement(QualifiedName.create("expr")));
    assertNull("Located non-existent InterfaceNavigationRef.", scope.getSingleElement(QualifiedName.create("unordered")));
// CHECKSTYLE:ON
}
Also used : ExportModel(com.avaloq.tools.ddk.xtext.export.export.ExportModel) IScope(org.eclipse.xtext.scoping.IScope) AbstractScopingTest(com.avaloq.tools.ddk.xtext.test.scoping.AbstractScopingTest) Test(org.junit.Test)

Example 8 with ExportModel

use of com.avaloq.tools.ddk.xtext.export.export.ExportModel in project dsl-devkit by dsldevkit.

the class ExportJavaValidator method checkReferencedInterfaceDeclared.

/**
 * Checks that there is an interface specification matching the given navigation.
 *
 * @param context
 *          navigation to check
 */
@Check
public void checkReferencedInterfaceDeclared(final InterfaceNavigation context) {
    if (context.getRef() == null || context.getRef().getEReferenceType() == null) {
        return;
    }
    ExportModel model = EObjectUtil.eContainer(context, ExportModel.class);
    EClass type = context.getRef().getEReferenceType();
    if (findMatchingInterfaces(model, type).isEmpty()) {
        error("No interface specification declared matching type " + type.getName(), ExportPackage.Literals.INTERFACE_NAVIGATION__REF);
    }
}
Also used : EClass(org.eclipse.emf.ecore.EClass) ExportModel(com.avaloq.tools.ddk.xtext.export.export.ExportModel) Check(org.eclipse.xtext.validation.Check)

Aggregations

ExportModel (com.avaloq.tools.ddk.xtext.export.export.ExportModel)8 AbstractScopingTest (com.avaloq.tools.ddk.xtext.test.scoping.AbstractScopingTest)5 IScope (org.eclipse.xtext.scoping.IScope)5 Test (org.junit.Test)5 Check (org.eclipse.xtext.validation.Check)2 Export (com.avaloq.tools.ddk.xtext.export.export.Export)1 Interface (com.avaloq.tools.ddk.xtext.export.export.Interface)1 IFingerprintComputer (com.avaloq.tools.ddk.xtext.resource.IFingerprintComputer)1 EClass (org.eclipse.emf.ecore.EClass)1 BindFactory (org.eclipse.xtext.generator.BindFactory)1 IQualifiedNameProvider (org.eclipse.xtext.naming.IQualifiedNameProvider)1 IDefaultResourceDescriptionStrategy (org.eclipse.xtext.resource.IDefaultResourceDescriptionStrategy)1 IFragmentProvider (org.eclipse.xtext.resource.IFragmentProvider)1