Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Xpand] Protected Region(Xpand protected region how to)
[Xpand] Protected Region [message #542322] Thu, 24 June 2010 14:29 Go to next message
Simon is currently offline SimonFriend
Messages: 6
Registered: June 2010
Junior Member
Using Xpand/Xtext 0.7.2

I successfully modified the mwe workflow to respect protected regions:

		<prSrcPaths value="src-protected/"/>
		<prDefaultExcludes value="true"/>
		<prExcludes value="*.xml"/>


The generated code I have now comments like that:

//PROTECTED REGION ID(com.mycomp.fef.fefDsl.impl.TransitionImpl@31f2a7) ENABLED START					
// Add your application specific code in this block
					
// End of application specific code block
//PROTECTED REGION END


However when I add some code in this block, it will disappear on the next regeneration.

Do I have to add files to the folder src-protected with the content of each protected region? And if yes, how do I have to format them that each regions receives its content? Is the symbol @ just an character or does it have a special function (besides seperating an enumerator from the URI)?

Thanks in advance!

PS: I know protected regions are outdated. Using Guice would be my next step.
Re: [Xpand] Protected Region [message #542388 is a reply to message #542322] Thu, 24 June 2010 16:32 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Simon,

do you clean the directory that contains the files with protected
regions? Please check the DirectoryCleaner component in your workflow
and the outlet configuration for the generator.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 24.06.10 16:29, schrieb Simon:
> Using Xpand/Xtext 0.7.2
>
> I successfully modified the mwe workflow to respect protected regions:
>
>
> <prSrcPaths value="src-protected/"/>
> <prDefaultExcludes value="true"/>
> <prExcludes value="*.xml"/>
>
>
> The generated code I have now comments like that:
>
>
> //PROTECTED REGION ID(com.mycomp.fef.fefDsl.impl.TransitionImpl@31f2a7)
> ENABLED START
> // Add your application specific code in this block
>
> // End of application specific code block
> //PROTECTED REGION END
>
>
> However when I add some code in this block, it will disappear on the
> next regeneration.
>
> Do I have to add files to the folder src-protected with the content of
> each protected region? And if yes, how do I have to format them that
> each regions receives its content? Is the symbol @ just an character or
> does it have a special function (besides seperating an enumerator from
> the URI)?
>
> Thanks in advance!
>
> PS: I know protected regions are outdated. Using Guice would be my next
> step.
Re: [Xpand] Protected Region [message #542518 is a reply to message #542388] Fri, 25 June 2010 07:49 Go to previous message
Simon is currently offline SimonFriend
Messages: 6
Registered: June 2010
Junior Member
Sebastian Zarnekow wrote on Thu, 24 June 2010 12:32
Hi Simon,

do you clean the directory that contains the files with protected
regions? Please check the DirectoryCleaner component in your workflow
and the outlet configuration for the generator.



No, I don't think so:

<workflow>
	<property name="modelFile" value="../FefModel/FefModel.fefdsl"/>
	<property name="targetDir" value="src-gen"/>
	<property name="outlet.src.protected.dir" value ="src-protected"/>

	<bean class="org.eclipse.emf.mwe.utils.StandaloneSetup" platformUri=".."/>
	
	<component class="org.eclipse.emf.mwe.utils.DirectoryCleaner" directory="${targetDir}"/>
	
	<component class="org.eclipse.xtext.MweReader" uri="${modelFile}">
		<!-- this class will be generated by the xtext generator -->
		<register class="com.mycomp.fef.FefDslStandaloneSetup"/>
	</component>
				
	<component class="org.eclipse.xpand2.Generator">
		<metaModel class="org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel"/>
		<fileEncoding value="Cp1252"/>
		<expand value="templates::Fef::main FOR model"/>
		<genPath value="${targetDir}"/>

		<!--<outlet path="${outlet.src.protected.dir}" name="src-protected" overwrite="true" />-->
		<prSrcPaths value="src-protected/"/>
		<prDefaultExcludes value="true"/>
		<prExcludes value="*.xml"/>
	</component>
</workflow>


DirectoryCleaner is only pointed to $targetDir

The overwrite option for $outlet.src.protected.dir is commented out.

Previous Topic:[Announce] JET Build Announcements
Next Topic:[Acceleo] Using Ecore as Metamodel
Goto Forum:
  


Current Time: Wed Apr 24 18:05:03 GMT 2024

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

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

Back to the top