Search in sources :

Example 1 with FeatureResourceDescription

use of org.yakindu.sct.generator.genmodel.resource.FeatureResourceDescription in project statecharts by Yakindu.

the class SGenScopeProvider method getLibraryScope.

protected SimpleScope getLibraryScope(Resource resource) {
    GeneratorModel generatorModel = (GeneratorModel) EcoreUtil.getObjectByType(resource.getContents(), SGenPackage.Literals.GENERATOR_MODEL);
    Assert.isNotNull(generatorModel);
    String generatorId = generatorModel.getGeneratorId();
    IGeneratorDescriptor generatorDescriptor = GeneratorExtensions.getGeneratorDescriptor(generatorId);
    Iterable<IEObjectDescription> allElements = Lists.newArrayList();
    if (generatorDescriptor != null) {
        Iterable<ILibraryDescriptor> libraryDescriptor = LibraryExtensions.getLibraryDescriptors(generatorDescriptor.getLibraryIDs());
        for (ILibraryDescriptor desc : libraryDescriptor) {
            Resource library = resourceSet.getResource(desc.getURI(), true);
            FeatureResourceDescription description = new FeatureResourceDescription(library);
            injector.injectMembers(description);
            allElements = Iterables.concat(allElements, description.getExportedObjects());
        }
    }
    return new SimpleScope(allElements);
}
Also used : FeatureResourceDescription(org.yakindu.sct.generator.genmodel.resource.FeatureResourceDescription) SimpleScope(org.eclipse.xtext.scoping.impl.SimpleScope) Resource(org.eclipse.emf.ecore.resource.Resource) GeneratorModel(org.yakindu.sct.model.sgen.GeneratorModel) IGeneratorDescriptor(org.yakindu.sct.generator.core.extensions.IGeneratorDescriptor) IEObjectDescription(org.eclipse.xtext.resource.IEObjectDescription) ILibraryDescriptor(org.yakindu.sct.generator.core.extensions.ILibraryDescriptor)

Example 2 with FeatureResourceDescription

use of org.yakindu.sct.generator.genmodel.resource.FeatureResourceDescription in project statecharts by Yakindu.

the class HelpIntegrationTest method getAllElements.

private Iterable<IEObjectDescription> getAllElements(String generatorId) {
    IGeneratorDescriptor generatorDescriptor = GeneratorExtensions.getGeneratorDescriptor(generatorId);
    Iterable<ILibraryDescriptor> libraryDescriptor = LibraryExtensions.getLibraryDescriptors(generatorDescriptor.getLibraryIDs());
    Iterable<IEObjectDescription> allElements = Lists.newArrayList();
    for (ILibraryDescriptor desc : libraryDescriptor) {
        Resource library = resourceSet.getResource(desc.getURI(), true);
        FeatureResourceDescription description = new FeatureResourceDescription(library);
        injector.injectMembers(description);
        allElements = Iterables.concat(allElements, description.getExportedObjects());
    }
    return allElements;
}
Also used : FeatureResourceDescription(org.yakindu.sct.generator.genmodel.resource.FeatureResourceDescription) Resource(org.eclipse.emf.ecore.resource.Resource) IGeneratorDescriptor(org.yakindu.sct.generator.core.extensions.IGeneratorDescriptor) ILibraryDescriptor(org.yakindu.sct.generator.core.extensions.ILibraryDescriptor) IEObjectDescription(org.eclipse.xtext.resource.IEObjectDescription)

Aggregations

Resource (org.eclipse.emf.ecore.resource.Resource)2 IEObjectDescription (org.eclipse.xtext.resource.IEObjectDescription)2 IGeneratorDescriptor (org.yakindu.sct.generator.core.extensions.IGeneratorDescriptor)2 ILibraryDescriptor (org.yakindu.sct.generator.core.extensions.ILibraryDescriptor)2 FeatureResourceDescription (org.yakindu.sct.generator.genmodel.resource.FeatureResourceDescription)2 SimpleScope (org.eclipse.xtext.scoping.impl.SimpleScope)1 GeneratorModel (org.yakindu.sct.model.sgen.GeneratorModel)1