use of org.yakindu.sct.generator.core.extensions.IGeneratorDescriptor in project statecharts by Yakindu.
the class SGenJavaValidator method checkContentType.
@Check
public void checkContentType(GeneratorEntry entry) {
GeneratorModel generatorModel = EcoreUtil2.getContainerOfType(entry, GeneratorModel.class);
IGeneratorDescriptor descriptor = GeneratorExtensions.getGeneratorDescriptor(generatorModel.getGeneratorId());
if (descriptor == null)
return;
String contentType = entry.getContentType();
if (contentType == null || contentType.trim().length() == 0) {
return;
}
if (!contentType.equals(descriptor.getContentType())) {
error(UNKNOWN_CONTENT_TYPE + contentType + "'", SGenPackage.Literals.GENERATOR_ENTRY__CONTENT_TYPE);
}
}
use of org.yakindu.sct.generator.core.extensions.IGeneratorDescriptor in project statecharts by Yakindu.
the class SGenJavaValidator method checkParameterValue.
@Check
public void checkParameterValue(final FeatureParameterValue value) {
if (value.getExpression() == null || value.getExpression() == null)
return;
GeneratorModel model = (GeneratorModel) EcoreUtil2.getRootContainer(value);
IGeneratorDescriptor generatorDescriptor = GeneratorExtensions.getGeneratorDescriptor(model.getGeneratorId());
IDefaultFeatureValueProvider provider = LibraryExtensions.getDefaultFeatureValueProvider(generatorDescriptor.getLibraryIDs(), value.getParameter().getFeatureType().getLibrary());
injector.injectMembers(provider);
IStatus status = provider.validateParameterValue(value);
createMarker(status);
}
use of org.yakindu.sct.generator.core.extensions.IGeneratorDescriptor in project statecharts by Yakindu.
the class SGenJavaValidator method checkRequiredParameters.
@Check
public void checkRequiredParameters(FeatureConfiguration configuration) {
GeneratorModel model = (GeneratorModel) EcoreUtil2.getRootContainer(configuration);
IGeneratorDescriptor generatorDescriptor = GeneratorExtensions.getGeneratorDescriptor(model.getGeneratorId());
Iterable<ILibraryDescriptor> libraryDescriptors = LibraryExtensions.getLibraryDescriptors(generatorDescriptor.getLibraryIDs());
Iterable<String> requiredParameters = transform(filter(concat(transform(filter(concat(transform(transform(libraryDescriptors, getFeatureTypeLibrary()), getFeatureTypes())), hasName(configuration.getType().getName())), getParameter())), isRequiredParamter()), getName());
List<String> configuredParameters = Lists.newArrayList();
for (FeatureParameterValue featureParameterValue : configuration.getParameterValues()) {
configuredParameters.add(featureParameterValue.getParameter().getName());
}
for (String string : requiredParameters) {
if (!configuredParameters.contains(string))
error(String.format(MISSING_REQUIRED_PARAMETER + " %s", string), SGenPackage.Literals.FEATURE_CONFIGURATION__TYPE);
}
}
use of org.yakindu.sct.generator.core.extensions.IGeneratorDescriptor in project statecharts by Yakindu.
the class SGenProposalProvider method completeGeneratorEntry_ContentType.
@Override
public void completeGeneratorEntry_ContentType(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
GeneratorModel generatorModel = EcoreUtil2.getContainerOfType(model, GeneratorModel.class);
IGeneratorDescriptor descriptor = GeneratorExtensions.getGeneratorDescriptor(generatorModel.getGeneratorId());
if (descriptor == null)
return;
ICompletionProposal proposal = createCompletionProposal(descriptor.getContentType(), context);
acceptor.accept(proposal);
}
use of org.yakindu.sct.generator.core.extensions.IGeneratorDescriptor 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;
}
Aggregations