Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to remove Xtext nature of only few files in the project
How to remove Xtext nature of only few files in the project [message #1691758] Thu, 09 April 2015 13:53 Go to next message
Naveenchandra Patil is currently offline Naveenchandra PatilFriend
Messages: 4
Registered: November 2014
Junior Member
Hello Xtext Experts!

We have defined a grammar for a DSL in our project. My editor works like a charm! Smile
But I have a use case where I have to remove Xtext nature of certain files (basically the grammar should treat those files as simple text files and not as files of DSL). Tried searching in net but with no much help Sad . I know that we can add or remove Xtext nature to a project. Is it possible to do the same at file or folder level too ? I dint see any setNatureids() method for a file or folder.

Background: We do a build of the project where the files of our DSLs will also be present. Sometimes we generate certain files (DSL files I mean) by the tool and hence there are chances that the files are not according to the grammar defined. So we get those error markers which is quite not that good to look.

Could you pls help me here...

Thanks in advance!

Cheers,
Naveen
Re: How to remove Xtext nature of only few files in the project [message #1691759 is a reply to message #1691758] Thu, 09 April 2015 13:58 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13884
Registered: July 2009
Senior Member
Hi,

you may have a look at org.eclipse.xtext.resource.IResourceServiceProvider.canHandle(URI)


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to remove Xtext nature of only few files in the project [message #1691838 is a reply to message #1691759] Fri, 10 April 2015 06:39 Go to previous messageGo to next message
Naveenchandra Patil is currently offline Naveenchandra PatilFriend
Messages: 4
Registered: November 2014
Junior Member
Hello,
Thank you so much for the response Smile
I created a class which extends org.eclipse.xtext.resource.IResourceServiceProvider and overrides the method canHandle(URI). But when I tried to bind this in the RunTimeModule class. I am facing strange problems Sad


Below is the method where I try to bind my ResourceServiceProvider class.

@Override
public Registry bindIResourceServiceProvider$Registry()
{
return new ResourceServiceProvider();
}

In my RuntimeModule class which extends org.eclipse.xtext.service.DefaultRuntimeModule I expected to override the method "bindIResourceServiceProvider" but instead I have to override "bindIResourceServiceProvider$Registry()".

Now from where should I get this registry ? and can I make sure that my ResourceServiceProvider class is called ?

Many Thanks again!
Re: How to remove Xtext nature of only few files in the project [message #1691847 is a reply to message #1691838] Fri, 10 April 2015 06:59 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13884
Registered: July 2009
Senior Member
Hi,

there is not a bindXXX Method for all Binding, some are done by @ImplementedBy.
but you can add all bindXXX Methods you like to have.

public Class<? extends IResourceServiceProvider> IResourceServiceProvider() {
		return MyDefaultResourceServiceProvider.class;
	}


in the runtime module

if you want a different behaviour in ui

public Class<? extends IResourceUIServiceProvider> bindIResourceUIServiceProvider() {
		return MyDefaultResourceUIServiceProvider.class;
	}


in the ui module


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Why are optional dependencies in Xtext greedy?
Next Topic:xtext-32 bits does not start
Goto Forum:
  


Current Time: Sat Apr 17 09:31:55 GMT 2021

Powered by FUDForum. Page generated in 0.01628 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top