Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Reload model after changing it in the background(Reload dsl-file after merging values from external file)
Reload model after changing it in the background [message #900984] Thu, 09 August 2012 10:03 Go to next message
Annette Pohl is currently offline Annette PohlFriend
Messages: 7
Registered: July 2012
Junior Member
Hi!

I created a DSL (correctly said: two DSLs) that generates language specific properties files in order to handle our translation stuff more easily in our projects.
Part of the specification was to export everything in csv in order to give it to a translator. He oder she translates everything and gives the csv back to the developer who merges the changes in the dsl-file.
I order to do the merging I created a wizard that merges the csv into the dsl file and overwrites the existing dsl file.
My problem is that eclipse recognizes that the file was changed and asks to refresh it but the dsl specific model won't refresh. If I close eclipse and start it again everything is fine but I have to force eclipse to refresh the dsl specific model in order to generate the properties files correctly after merging a csv file.

Any help is highly appreciated.
Annette
Re: Reload model after changing it in the background [message #901022 is a reply to message #900984] Thu, 09 August 2012 12:56 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
Do you use Eclipse's Resource API when modfiying the file in the wizard?

Sven

Am 8/9/12 12:03 PM, schrieb Annette Pohl:
> Hi!
>
> I created a DSL (correctly said: two DSLs) that generates language
> specific properties files in order to handle our translation stuff more
> easily in our projects.
> Part of the specification was to export everything in csv in order to
> give it to a translator. He oder she translates everything and gives the
> csv back to the developer who merges the changes in the dsl-file.
> I order to do the merging I created a wizard that merges the csv into
> the dsl file and overwrites the existing dsl file.
> My problem is that eclipse recognizes that the file was changed and asks
> to refresh it but the dsl specific model won't refresh. If I close
> eclipse and start it again everything is fine but I have to force
> eclipse to refresh the dsl specific model in order to generate the
> properties files correctly after merging a csv file.
>
> Any help is highly appreciated.
> Annette


--
Need professional support for Xtext or other Eclipse Modeling technologies?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : http://blog.efftinge.de
Re: Reload model after changing it in the background [message #901034 is a reply to message #901022] Thu, 09 August 2012 13:34 Go to previous messageGo to next message
Annette Pohl is currently offline Annette PohlFriend
Messages: 7
Registered: July 2012
Junior Member
No, I developed some kind of merge-service in a test-case with java.io.
I do know nothing about Eclipse's Resource API. Do you mean the package org.eclipse.core.resources?
After having a quick glance at it I think I will try to write the merged content to IFile instead of writing to an OutputStream.
Re: Reload model after changing it in the background [message #901272 is a reply to message #900984] Fri, 10 August 2012 15:01 Go to previous messageGo to next message
Annette Pohl is currently offline Annette PohlFriend
Messages: 7
Registered: July 2012
Junior Member
After a lot of debugging and running into all kinds of strange behaviour of Eclipse I finally found out what I was doing wrong. Some kind of really stupid mistake:

I created my "Merging-Service" standalone with a test-case because that was far more efficient than to develop and test it with a wizard. Guess how I initialized it!

		TranslationCoreStandaloneSetup.doSetup();
		Injector injector = new TranslationI18nStandaloneSetupGenerated().createInjectorAndDoEMFRegistration();
		return injector.getInstance( II18nTransferService.class );


Eclipse did not like this at all and I can't be angry with it - totally my stupidity.

But now I am facing a completely different problem and I hope that some of you helps me.

To do the merging I get two filenames of the user. One is a csv file with the changes that should be merged into the second file which is a DSL file.
I now fail to get the resource of the model. In the standalone test I did it this way:

			ResourceSet resourceSet = resourceSetProvider.get();
			Resource i18nResource = resourceSet.getResource( URI.createFileURI( i18nFileName ), true );


and

	@Inject
	private Provider<ResourceSet> resourceSetProvider;


Within Eclipse the resourceSetProvider is null and I wonder what to do. Do I have to bind it? But how is this to be done? Or is there a better way to get a resource of my DSL within Eclipse? I guess it must be somewhere out in Eclipse....
Re: Reload model after changing it in the background [message #901275 is a reply to message #901272] Fri, 10 August 2012 15:10 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi have a look at iresourcesetprovider

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Reload model after changing it in the background [message #901279 is a reply to message #901275] Fri, 10 August 2012 15:29 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Btw you need to make proper use of guice to get the things injected (YourdslExecutableExtensionFactory)

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Reload model after changing it in the background [message #901283 is a reply to message #901279] Fri, 10 August 2012 15:44 Go to previous messageGo to next message
Annette Pohl is currently offline Annette PohlFriend
Messages: 7
Registered: July 2012
Junior Member
Thanks, Christian, for your replies.

I have no clue about this ExecutableExtensionFactory and google did not tell me something that I could understand. But I am a bit worn out at the moment. If you could point me to any post or documentation concerning this issue I would be very thankful.
Re: Reload model after changing it in the background [message #901289 is a reply to message #901283] Fri, 10 August 2012 15:53 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi have a look at the plugin.XML of yourdsl.UI project
If you write factory:class instead of class in your declarations you
can use Google guice in you classes (otherwise @injects will never be
done)

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Reload model after changing it in the background [message #902370 is a reply to message #901289] Fri, 17 August 2012 11:21 Go to previous message
Annette Pohl is currently offline Annette PohlFriend
Messages: 7
Registered: July 2012
Junior Member
Hi Christan,
the last few days I was tied up with other stuff but today I continued with my wizard and the merging. Thanks for your hints: It is working now.
Have a nice weekend!
Previous Topic:How Parse(Unparse(Model)) == Model?
Next Topic:Shift-reduce conflict between grammar rule and terminal in Xtext
Goto Forum:
  


Current Time: Thu Apr 25 11:27:23 GMT 2024

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

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

Back to the top