I have two products. For example A and B. In A product i need to enable to one validation which is present in AValidator.xtend file and B product is depends on A so when i run B product that check needs to be disable the warning.
def validateElement(Element e)
warning('''Element «e.name» missing in files.''', e, package.Literals.NAMED__NAME)
The same check should not be work for BProduct.
Is there any override function can do for these?
Many thanks in advance.
Best How To :
There are two ways to solve this:
You can add a system property (probably a
boolean flag) which enables this feature. In the ini file of A, you enable the option. In B, you omit it.
You can split the plugin into a library and then two plugins which you use in the products.
Splitting the plugin works like this:
You need to create a new plugin and copy all the shared code into it. It can also contain the code from the validation which is the same for both products. Give the validation code the name
In this plugin, you need to rename
Dsl is the name of your grammer, it extends
AbstractDslRuntimeModule which contains the binding for the validation). Rename it to
Then you create a plugin for product A. It contains the specific validation. This class needs to extend
You also need to create a binding which extends
SharedDslRuntimeModule and so you can bind the new validator class.
That's the rough outline. You will have to copy/change several other files (like the
DslStandaloneSetup and the
plugin.xml), too, but those changes should become obvious when you fix the compile errors.
... Maybe a flag is more simple.