JET in GMF Project [message #23417] |
Thu, 21 June 2007 15:12  |
Eclipse User |
|
|
|
Originally posted by: vinsarwate.yahoo.com
Hi,
I know there are few threads in this newgroup that discussed issues
related to this topic but please take a few sec to read this and pl help
me out.
In my case, I want the capability to right click and generate code (say
Java code) from my model file (some_diagram.workflow). To achieve this I
performed following steps.
1. Added JET Nature to my GMF diagram plugin project
(something.workflow.diagram).
2. Added required template to template folder. Following is a snippet from
one of the template -
<%@ jet package="something.workflow.diagram.generate"
class="WorkFlowToJavaTemplate" imports="......"%>
<% WorkFlowDiagram diagram = (WorkFlowDiagram) argument;
List activities= diagram.getActivities();
for (Iterator iter = activities.iterator(); iter.hasNext();) {
Activity activity = (Activity) iter.next();
stringBuffer.append(activity.getName());
}
%>
3. I have created an popupMenu extentension to call CodeGenerationAction
in GMF diagram plugin project. This action reads WorkFlowDiagram from
selected WorkFlow model file in navigator and passes this WorkFlowDiagram
instance to templated generated WorkFlowToJavaTemplate class.
At runtime, when I right click on WorkFlow model file and select
"Generate" option from popup menu, I am getting following error -
Feature 'version' not found. (file:///WorkFlowProject/default.workflow, 2,
175)
I know this is a bug already reported by Paul
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=190809).
But my question is what is the workaround.
In one of the previous thread
( http://www.eclipse.org/newsportal/article.php?id=252&gro up=eclipse.modeling.m2t#252)
Paul explained in detail how to read EMF document. I followed those steps
to solve this problem but was not able to get passed this error.
Please see that when I added JET nature to my GMF Diagram project, it does
not create "org.eclipse.jet.transform" entry in plugin.xml. I manually
created this entry, added required dependencies and also modified
"modelLoader" attribute of "transform" node to "org.eclipse.jet.emf". But
no luck.
Could anyone please provide me pointers/guideline to achieve this
right-click and generate functionality.
Thanks.
Vinay
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03063 seconds