Registration problem of GCM package of MARTE Profile [message #724656] |
Mon, 12 September 2011 18:28  |
Atif Javed Messages: 21 Registered: March 2010 |
Junior Member |
|
|
Hello friends,
I am unable to register GCM package of MARTE profile with ACCELEO. I have tried to find help and good article related to registration of MARTE profile over internet and tried several other things but did not succeed. Now, I am stuck and need your help. Step by step information about what I'm doing is listed below:
1. I press right click on package explorer and select new other ACCELEO project.
2. I press next button and type project name: org.eclipse.marteprofile.registration
3. After pressing next button, I press add metamodel URI's button and select Runtime Version radio button. I select meta model: http://www.eclipse.org/papyrus/GCM/1 and press ok button.
4. I select type: ClientServerPort. Plus, I checked the Generate File and Main Template check boxes and make no changes in Module Name and Template Name. Later, I pressed finish button.
5. I opened the generate.mtl file and give the name of generated file: 'generated.xml'. Now, generate.mtl file is:
[comment encoding = UTF-8 /]
[module generate('http://www.eclipse.org/papyrus/GCM/1')]
[template public generateElement(port : ClientServerPort)]
[comment @main/]
[file (('generated.xml'), false, 'UTF-8')]
//Registration of GCM package
[/file]
[/template]
6. I opened Generate.java file and changed @generated to @generated Not for both registerPackages and registerResourceFactories methods.
7. In register packages method, now package to be registered is visible. I have added dependencies for that package. Now, methods for registerPackages and registerResourceFactories are:
public void registerPackages(ResourceSet resourceSet) {
super.registerPackages(resourceSet);
if (!isInWorkspace(org.eclipse.papyrus.MARTE.MARTE_DesignModel.GCM.GCMPackage.class)) {
resourceSet.getPackageRegistry().put(org.eclipse.papyrus.MARTE.MARTE_DesignModel.GCM.GCMPackage.eINSTANCE.getNsURI(), org.eclipse.papyrus.MARTE.MARTE_DesignModel.GCM.GCMPackage.eINSTANCE);
}
}
public void registerResourceFactories(ResourceSet resourceSet) {
super.registerResourceFactories(resourceSet);
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());
}
8. I pressed right click on created ACCELEO project and select ACCELEO Create ACCELEO UI Launcher Project. I let project name org.eclipse.marteprofile.registration.ui unchanged. In next step, I make sure that ACCELEO project is selected in list of reference projects. I press next button and make no changes for Generator Name and Configuration. Finally, I pressed finish button and now ACCELEO launcher is created.
9. Now, I run new eclipse Instance, I have created a new java project named: GCMProfileTesting. I create a new folder model and press right on it and select other UML Model. I select file name as: GCM.uml. In next step, I select Model Object as Model and press finish button. Now, UML model is created.
10. I opened the model and select Model element. Later, I select Package Apply Profile from UML editor list. I added MARTE::MARTE_DESIGNMODEL::GCM
11. I added new component as new Child Packaged Element Component (name: GCM)
12. I clicked at component and select new Child Owned Port Port (name: port1)
13. I have selected port and added clientserverport stereotype by selecting UML Editor List then select Element Apply Stereotype and added MARTE::MARTE_DesignModel::GCM::ClientServerPort from newly opened window.
14. I saved the model, press right click on it and launch generator by selecting ACCELEO Model to Text Generate Registration
15. No file is generated and I see this error in my console:
!MESSAGE The generation fail to generate any file because there are no model elements that matches at least the type of the first parameter of one of your main templates.
The problem may be caused by a problem with the registration of your metamodel, please see the method named "registerPackages" in the Java launcher of your generator.
Please help me in identifying that what mistake I'm doing? I'm very thankful to you. I have attached my Metamodel for marte profile, sample Acceleo Projects and GCMProfileTesting project (created for testing the registration of model).
Regards,
Atif/
|
|
|
|
Powered by
FUDForum. Page generated in 0.02004 seconds