use of org.yakindu.sct.model.sgen.GeneratorModel in project statecharts by Yakindu.
the class GenModelLoader method load.
public static GeneratorModel load(IFile file) {
Resource resource = null;
URI uri = URI.createPlatformResourceURI(file.getFullPath().toString(), true);
resource = new ResourceSetImpl().getResource(uri, true);
if (resource == null || resource.getContents().size() == 0 || resource.getErrors().size() > 0)
return null;
final GeneratorModel model = (GeneratorModel) resource.getContents().get(0);
return model;
}
use of org.yakindu.sct.model.sgen.GeneratorModel 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.model.sgen.GeneratorModel in project statecharts by Yakindu.
the class GTestHelper method getGeneratorModel.
protected GeneratorModel getGeneratorModel(String sgenFileName) {
IPath path = new Path(sgenFileName);
Resource sgenResource = loadResource(getWorkspaceFileFor(path));
GeneratorModel model = (GeneratorModel) sgenResource.getContents().get(0);
return model;
}
use of org.yakindu.sct.model.sgen.GeneratorModel in project statecharts by Yakindu.
the class GTestHelper method generate.
public void generate() {
IPath targetPath = getTargetPath();
// copy model to JUnit workspace
copyFileFromBundleToFolder(getModelBundle(), getModelPath(), targetPath);
String sgenFileName = getSgenFileName(getTestProgram());
copyFileFromBundleToFolder(getTestBundle(), sgenFileName, targetPath);
GeneratorModel model = getGeneratorModel(sgenFileName);
model.getEntries().get(0).setElementRef(getStatechart());
performFullBuild();
getGeneratorExecutorLookup().execute(model);
}
use of org.yakindu.sct.model.sgen.GeneratorModel in project statecharts by Yakindu.
the class SGenJavaValidatorTest method checkDeprecatedParameters.
/**
* @see SGenJavaValidator#checkDeprecatedParameters(GeneratorEntry)
*/
@Test
public void checkDeprecatedParameters() {
EObject model = parseExpression("GeneratorModel for yakindu::java { statechart Example { feature Outlet {targetFolder = \"src-gen\" targetProject = \"TestProject\" }}}", GeneratorModel.class.getSimpleName());
if (!(model instanceof GeneratorModel)) {
fail("Model is of the wrong type");
} else {
GeneratorModel genModel = (GeneratorModel) model;
genModel.getEntries().get(0).getFeatures().get(0).getType().getParameters().get(0).setDeprecated(true);
AssertableDiagnostics result = tester.validate(genModel);
result.assertAny(new MsgPredicate(DEPRECATED));
}
}
Aggregations