Extending XtextBuilder for two DSLs [message #1844694] |
Wed, 22 September 2021 01:28  |
Eclipse User |
|
|
|
Hi,
I am trying to extend XtextBuilder for two different DSLs.
I have created two Xtext project for the two different DSLs and extended XtextBuilder in both projects. Now on save it always calls extended class of XtextBuilder of second project. This is irrespective of the resource. (Whether it is from first or second DSL).
My requirement is to call the extended class of XtextBuilder based on file extension. Could you please guide me on this?
Thanks and regards,
Virag
|
|
|
|
Re: Extending XtextBuilder for two DSLs [message #1844696 is a reply to message #1844695] |
Wed, 22 September 2021 01:42   |
Eclipse User |
|
|
|
Hi Mr. Christian Dietrich,
I have just added the example below. In this case it always calls the MyDsl2Builder. Even if I am saving the resource which is from MyDsl1. I have created two xtext projects with MyDsl1 grammar and MyDsl2 grammar. Requirement was to create two separate xtext projects for both the grammar.
MyDsl1Builder.java
public class MyDsl1Builder extends XtextBuilder {
@Override
protected IProject[] build(final int kind, Map args, IProgressMonitor monitor) throws CoreException {
// I want to add my custom implementation
return super.build(kind, args, monitor);
}
}
MyDsl2Builder.java
public class MyDsl2Builder extends XtextBuilder {
@Override
protected IProject[] build(final int kind, Map args, IProgressMonitor monitor) throws CoreException {
// I want to add my custom implementation
return super.build(kind, args, monitor);
}
}
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.30774 seconds