Stopping Xtext from replacing generated files/methods [message #1794709] |
Wed, 05 September 2018 10:00 |
Rohit Verma Messages: 21 Registered: August 2017 |
Junior Member |
|
|
I am trying to get my custom ValueConverters to work as outlined here. All seems to be working fine, expect that whenever I change the grammar and regenerate the code, the contents of the bindIValueConverterService method in AbstractExpressionDslRuntimeModule (which extends DefaultRuntimeModule) are replaced to refer to the old/default valueconverter which I want to replace with custom value converter. So my question is how can I prevent that from happening?
I understand that overriding the bindIValueConverterService method as specified here should be enough, however it doesn't seem to work for me.
Files are below:
import <lots of stuff>
/**
* Manual modifications go to {@link ExpressionDslRuntimeModule}.
*/
@SuppressWarnings("all")
public abstract class AbstractExpressionDslRuntimeModule extends DefaultRuntimeModule {
protected Properties properties = null;
@Override
public void configure(Binder binder) {
properties = tryBindProperties(binder, "ca/mcgill/sel/ram/expressions/ExpressionDsl.properties");
super.configure(binder);
}
public void configureLanguageName(Binder binder) {
binder.bind(String.class).annotatedWith(Names.named(Constants.LANGUAGE_NAME)).toInstance("ca.mcgill.sel.ram.expressions.ExpressionDsl");
}
// contributed by org.eclipse.xtext.xtext.generator.formatting.Formatter2Fragment2
public void configureFormatterPreferences(Binder binder) {
binder.bind(IPreferenceValuesProvider.class).annotatedWith(FormatterPreferences.class).to(FormatterPreferenceValuesProvider.class);
}
// contributed by org.eclipse.xtext.xtext.generator.ecore2xtext.Ecore2XtextValueConverterServiceFragment2
public Class<? extends IValueConverterService> bindIValueConverterService() {
return Ecore2XtextTerminalConverters.class;
}
import org.eclipse.xtext.conversion.IValueConverterService
/**
* Use this class to register components to be used at runtime / without the Equinox extension registry.
*/
class ExpressionDslRuntimeModule extends AbstractExpressionDslRuntimeModule {
override Class<? extends IValueConverterService> bindIValueConverterService() {
return CustomValueConverter;
}
}
Any help would be appreciated. Thanks!
[Updated on: Wed, 05 September 2018 10:02] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03131 seconds