Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable "Add Xtext nature" dialog in Eclipse

Tags:

eclipse

dsl

xtext

I'm using a custom DSL with Xtext grammar. In my workspace there are several projects, one of them is the development relevant project, another one is for testing purposes.

In the testing project there are a lot (> 5000) of files of my DSL, required for JUnit tests.

When the Xtext nature is added to this project, rebuilding it takes a long time, so I removed it. It's not important to me in the project anyways. But now everytime I open one of the files, Xtext asks me to add the nature to this project.

Can I disable this dialog, for a specific project or in general?

Thanks for answers!

like image 485
moeTi Avatar asked Jul 20 '12 09:07

moeTi


1 Answers

I believe, the NatureAddingEditorCallback class is responsible for that feature.

To replace this functionality for your language, I would try the following: Open the «LanguageName»UiModule class from your UI project (be careful, it is in the src folder; an abstract version is in the src-gen folder), and add the following lines (this piece of code came from the XtextUIModule class):

public Class<? extends IXtextEditorCallback> bindIXtextEditorCallback() {
    return org.eclipse.xtext.builder.nature.NatureAddingEditorCallback.class;
}

Then replace the returned class with your own.

like image 70
Zoltán Ujhelyi Avatar answered Sep 21 '22 06:09

Zoltán Ujhelyi