Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Xpand / Xtend] Recognizing custom UML Profile(How can I import my custom Profile)
[Xpand / Xtend] Recognizing custom UML Profile [message #639025] Sun, 14 November 2010 20:53 Go to next message
Muba  is currently offline Muba Friend
Messages: 20
Registered: November 2009
Junior Member
Hi,

I have created a really simple uml profile and a uml model which uses this profile (uml2 3.0.0).

I think I am loading the profile correctly in my workflow, but I do not know what I have to do so that the Xpand and Xtend editor will recognize my profile and its stereotypes.

I am not using packages in my uml models (neither in the sample.uml nor in the Forms.profile.uml). I guess that does not have to do anything with it, does it?
Both uml files are not within my Xpand project, but in their own projects.

I am using eclipse helios and I create my uml models with papyrus.

Where in my Xpand project do I have to add my Profile so the editors will recognize my profile (e.g. so that I can import that profile)?

I dont think just loading it in the workflow (see below) will do it, right?

I searched the forums and the internet. Either I haven't found the answer yet, or it should have worked like that.
Since I do not know what to do, I hope someone here can help me out.

<?xml version="1.0"?>
<workflow>
	<property name="model" value="GoogleFormsUML/Sample.uml" />
	<property name="profile" value="UMLProfiles/Forms.profile.uml" />
	<property name="src-gen" value="src-gen" />
	
	
	
	<!-- set up EMF for standalone execution -->
	<bean class="org.eclipse.emf.mwe.utils.StandaloneSetup" >
		<platformUri value=".."/>
		<registerGeneratedEPackage value="org.eclipse.uml2.uml.UMLPackage"/>		
	</bean>
	
	<!-- instantiate metamodel -->
	<bean id="mm" class="org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel"/>

	<!-- Profile Model -->
	<bean id="formsProfile" class="org.eclipse.xtend.typesystem.uml2.profile.ProfileMetaModel">
		<profile value="platform:/resource/${profile}" />
	</bean>

	<component class="org.eclipse.emf.mwe.utils.Reader">
		<uri value="platform:/resource/${model}" />
		<modelSlot value="model" />
	</component>
	
		<!--  generate code -->
	<component class="org.eclipse.xpand2.Generator">
		<metaModel idRef="mm"/>
		<metaModel idRef="formsProfile"/>
		<expand
			value="template::template::main FOR model" />
		<outlet path="${src-gen}" >
			<postprocessor class="org.eclipse.xpand2.output.JavaBeautifier" />
		</outlet>
	</component>
</workflow>
Re: [Xpand / Xtend] Recognizing custom UML Profile [message #639026 is a reply to message #639025] Sun, 14 November 2010 21:43 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 6550
Registered: July 2009
Senior Member
Hi

here is a uml sample workflow for xpand

<workflow>
	
	<bean class="org.eclipse.xtend.typesystem.uml2.Setup" standardUML2Setup="true" />
	
	<bean class="org.eclipse.emf.mwe.utils.StandaloneSetup" platformUri=".." />
	
	<component class="org.eclipse.emf.mwe.utils.Reader">
		<uri value="platform:/resource/xpand.uml.profile.sample/src/model/test.uml" />
		<modelSlot value="model" />
	</component>
	
	<component class="org.eclipse.emf.mwe.utils.DirectoryCleaner">
		<directory value="src-gen" />
	</component>
	
	
	<component class="org.eclipse.xpand2.Generator">
		<metaModel class="org.eclipse.xtend.typesystem.uml2.profile.ProfileMetaModel">
			<profile value="platform:/resource/xpand.uml.profile.sample/src/model/test.profile.uml" />
		</metaModel>
		<metaModel class="org.eclipse.xtend.typesystem.uml2.UML2MetaModel" />
		<expand value="template::Template::main FOR model" />
		<outlet path="src-gen" >
			<postprocessor class="org.eclipse.xpand2.output.JavaBeautifier" />
		</outlet>
	</component>
	

</workflow>


to get the editor running you have to enable uml profiles in your generator projects xtend/xpand properties. the files should be on the classpath.

~Christian

[Updated on: Sun, 14 November 2010 21:46]

Report message to a moderator

Re: [Xpand / Xtend] Recognizing custom UML Profile [message #641826 is a reply to message #639026] Sun, 28 November 2010 15:01 Go to previous message
Muba  is currently offline Muba Friend
Messages: 20
Registered: November 2009
Junior Member
Hi,

sorry that I did not reply sooner, but due to some stuff I couldn't get back to this project until now.

After putting the profile in my src folder and activating the uml2 Profile everything works fine.

Thank you very much.


Muba
Previous Topic:[XPand] Invoke XPand programmatically: how templates are resolved?
Next Topic:[Xpand] Merging several models into one output (file)
Goto Forum:
  


Current Time: Sun Dec 21 18:58:39 GMT 2014

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

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