use of com.avaloq.tools.ddk.xtext.export.export.ExportModel in project dsl-devkit by dsldevkit.
the class ExportScopingTest method testEStructuralFeatureScope.
@Test
public void testEStructuralFeatureScope() throws IOException {
ExportModel model = (ExportModel) getTestSource().getModel();
IScope scope = scopeProvider.scope_EStructuralFeature(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("unorderedX")));
// CHECKSTYLE:ON
}
use of com.avaloq.tools.ddk.xtext.export.export.ExportModel in project dsl-devkit by dsldevkit.
the class ExportJavaValidator method checkFingerprintInterfaceDefined.
/**
* Checks that the interface referenced by a fingerprint is defined.
*
* @param context
* export to check
*/
@Check
public void checkFingerprintInterfaceDefined(final Export context) {
if (context.isFingerprint() || context.isResourceFingerprint()) {
ExportModel model = EObjectUtil.eContainer(context, ExportModel.class);
Interface match = null;
for (Interface iface : model.getInterfaces()) {
if (iface.getType().isSuperTypeOf(context.getType())) {
match = iface;
break;
}
}
if (match == null) {
error("No matching interface specification declared", context.isFingerprint() ? ExportPackage.Literals.EXPORT__FINGERPRINT : ExportPackage.Literals.EXPORT__RESOURCE_FINGERPRINT);
}
}
}
use of com.avaloq.tools.ddk.xtext.export.export.ExportModel in project dsl-devkit by dsldevkit.
the class ExportFragment method getGuiceBindingsRt.
/**
* {@inheritDoc}
*/
@Override
public Set<Binding> getGuiceBindingsRt(final Grammar grammar) {
final BindFactory bindFactory = new BindFactory();
// $NON-NLS-1$
final String namingPrefix = GrammarUtil.getNamespace(grammar) + ".naming." + GrammarUtil.getName(grammar);
// $NON-NLS-1$
final String resourcePrefix = GrammarUtil.getNamespace(grammar) + ".resource." + GrammarUtil.getName(grammar);
ExportModel m = getModel(grammar);
if (m != null) {
// $NON-NLS-1$
bindFactory.addTypeToType(IQualifiedNameProvider.class.getName(), namingPrefix + "ExportedNamesProvider");
if (!m.getInterfaces().isEmpty()) {
// $NON-NLS-1$
bindFactory.addTypeToType(IFingerprintComputer.class.getName(), resourcePrefix + "FingerprintComputer");
}
if (!m.getExports().isEmpty()) {
// $NON-NLS-1$
bindFactory.addTypeToType(IDefaultResourceDescriptionStrategy.class.getName(), resourcePrefix + "ResourceDescriptionStrategy");
}
if (Iterables.any(m.getExports(), new Predicate<Export>() {
@Override
public boolean apply(final Export input) {
return input.isFingerprint() && input.getFragmentAttribute() != null;
}
})) {
// $NON-NLS-1$
bindFactory.addTypeToType(IFragmentProvider.class.getName(), resourcePrefix + "FragmentProvider");
}
}
// $NON-NLS-1$
bindFactory.addTypeToType(IResourceDescription.Manager.class.getName(), resourcePrefix + "ResourceDescriptionManager");
return bindFactory.getBindings();
}
use of com.avaloq.tools.ddk.xtext.export.export.ExportModel in project dsl-devkit by dsldevkit.
the class ExportScopingTest method testEclassScope.
@Test
public void testEclassScope() throws IOException {
ExportModel model = (ExportModel) getTestSource().getModel();
IScope scope = scopeProvider.scope_EClass(model, null);
assertNotNull("Could not locate EClass.", scope.getSingleElement(QualifiedName.create("InterfaceExpression")));
assertNull("Located non-existent EClass.", scope.getSingleElement(QualifiedName.create("InterfaceExpressionX")));
}
use of com.avaloq.tools.ddk.xtext.export.export.ExportModel in project dsl-devkit by dsldevkit.
the class ExportScopingTest method testImportPackageScope.
@Test
public void testImportPackageScope() throws IOException {
ExportModel model = (ExportModel) getTestSource().getModel();
IScope scope = scopeProvider.scope_Import_package(model.getImports().get(0), ExportPackage.Literals.IMPORT__PACKAGE);
assertNotNull("Could not locate Import.", scope.getSingleElement(QualifiedName.create("http://www.avaloq.com/tools/ddk/xtext/export/Export")));
assertNull("Located non-existent Import.", scope.getSingleElement(QualifiedName.create("http://www.avaloq.com/tools/ddk/xtext/export/ExportX")));
}
Aggregations