Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo]I don't want to chang the timestamp when the content is not changed
[Acceleo]I don't want to chang the timestamp when the content is not changed [message #870541] Tue, 08 May 2012 15:44 Go to next message
Ou liang is currently offline Ou liangFriend
Messages: 5
Registered: April 2012
Junior Member
Hi all,
When I use Acceleo to generate file,and maybe the file have already exist,but if the new file have the same content with the old and I don't want to chang the timestamp,what can I do? sometimes the timestamp is important for some file.

Thanks
Re: [Acceleo]I don't want to chang the timestamp when the content is not changed [message #870638 is a reply to message #870541] Wed, 09 May 2012 07:35 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Hi,

The default generation strategy of Acceleo is to write on-the-fly, except for files with "@generated" tags which will be overriden when we know their full content (yet we pass these to EMF's JMerge... which by default creates a new file even if the content is identical IIRC).

You will need to change this default strategy to implement what you are trying to achieve. This can be done through the "getGenerationStrategy" of the generated java file beside your main template.

You need to use another strategy in order not to override files that would not change. By default, we provide one such implementation through the "WorkspaceAwareStrategy" ... but that only works within an Eclipse workspace. If you are generating files outside of Eclipse, you need to implement your own. The easiest for you is probably to look at the org.eclipse.acceleo.engine.generation.strategy.WorkspaceAwareStrategy file and start from there, removing the uses of eclipse's "IFile" implementations to instead use "java.io.File".

[edit : in fact, the WorkspaceAwareStrategy might also work outside of Eclipse, though untested, the code takes that possibility into account]

Laurent Goubet
Obeo

[Updated on: Wed, 09 May 2012 07:37]

Report message to a moderator

Re: [Acceleo]I don't want to chang the timestamp when the content is not changed [message #873590 is a reply to message #870638] Fri, 18 May 2012 15:50 Go to previous message
Ou liang is currently offline Ou liangFriend
Messages: 5
Registered: April 2012
Junior Member
Hi Laurent Goubet,
With the use of the class WorkspaceAwareStrategy,the timestamp will not change when the content is not changed,because the files inside the Eclipse.
Thanks for your help.

Ou liang
Previous Topic:XML input to ecore
Next Topic:[XPAND] Traverse all elements of a class
Goto Forum:
  


Current Time: Fri Apr 19 21:51:26 GMT 2024

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

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

Back to the top