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 SharedValidator
In this plugin, you need to rename DslRuntimeModule
(Dsl
is the name of your grammer, it extends AbstractDslRuntimeModule
which contains the binding for the validation). Rename it to SharedDslRuntimeModule
.
Then you create a plugin for product A. It contains the specific validation. This class needs to extend SharedValidator
.
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.