Throw error in generator [message #1809744] |
Mon, 22 July 2019 07:01  |
Eclipse User |
|
|
|
Greetings everyone !
I am trying to generate code, i have to do lot of validation(just throw error) and it should be performed only just prior to generation.
I have created a class with all validation logics inside DeepValidation class
class DeepValidation extends AbstractMemDesignValidator
{
def init(IResourceDescriptions resDescription)
{
//Initializations for validation
}
@Check(CheckType.NORMAL)
def validation()
{
// Validation logics
}
}
I am invoking the above validation in my code generation logic, the function just halts at
...
error('Error', obj, Package.Literals.FEATURE)
...
neither it proceed further nor throws error. The code just halts here !
Background.
1) I have defined proper Grammer
2) I have defined validations, which was working fine.
3) I have defined generator and I was able to generate code properly as expected
Points to consider:
1) I have multiple dsl files (a.dsl, b.dsl, ...)
2) I have multiple grammers in my project ( a.dsl1, b.dsl1, .... a.dsl2, b.dsl2, ....)
My Questions:
1) What is going wrong ? Can't I throw error from generator package ? What is your suggestion ?
Ans: ....
2) I am Injecting IResourceDescriptions in my Generator class
class Generator extends AbstractGenerator implements IGenerator2
{
@Inject
IResourceDescriptions resourceDescription
override doGenerate(Resource input, IFileSystemAccess2 fsa, IGeneratorContext context)
{
var CSourceGenerator sourceCodeGenerator = new CSourceGenerator()
sourceCodeGenerator.SourceCodeGenerator(resourceDescription, fsa)
}
}
resourceDescription is loaded(with all data from all dsl files) only after a change in resource. What should I do to load data into resourceDescription immediately after the tool starts ?
Ans: ...
** I am basically from embedded domain, novice in xtext & xtend **
Mit freundlichen Grüßen / Regards
Maha
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.07807 seconds