Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Status of code generation in Papyrus?(Code generation mentioned in user guide, but unavailable in Eclipse)
Status of code generation in Papyrus? [message #1030018] Sat, 30 March 2013 10:54 Go to next message
Jay Billings is currently offline Jay Billings
Messages: 40
Registered: July 2011
Member
Everyone,

I have imported a UML model from IBM Rational Software Architect into Papyrus and I would like to generate code from it. I found some tutorials on the old Papyrus site showing videos of the code generator (run via run configurations), but it appears to be unavailable in Eclipse Juno SR2. It is listed, but not discussed in the user's guide at:

http://wiki.eclipse.org/Papyrus_User_Guide#C.2FC.2B.2B_Code_Generation

Could someone please tell me what the status is of this capability? It is available now, planned for some future release or unplanned?

Thanks!

Jay


Jay Jay Billings
Oak Ridge National Laboratory
Twitter: @jayjaybillings
Re: Status of code generation in Papyrus? [message #1030124 is a reply to message #1030018] Sat, 30 March 2013 14:27 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 3842
Registered: July 2009
Senior Member
Hi

It depends what you mean by code generation.

If you just want class structure (Package, Class, Property, Operation) ,
that has been available for a long time via the UML to Ecore converter.
EMF supports generation of Java from the Ecore model.

If you also want OCL elaboration of Class invariants and Operation
bodies, then you will be pleased to know that a stupid bug has been
fixed for Kepler so that the OCL is correctly expressed as Ecore
delegates for interpretation at run-time. You may be even more pleased
that the OCL to Java code generator is fully integrated so that if you
genmodel you get compiled Java for the OCL.

If you also want more advanced UML facilities such as State Machines,
you need to look for additional tooling. I suspect that Acceleo may have
some examples.

You may note that none of the above is a Papyrus facility; they are more
general.

Regards

Ed Willink


On 30/03/2013 14:54, Jay Billings wrote:
> Everyone,
>
> I have imported a UML model from IBM Rational Software Architect into
> Papyrus and I would like to generate code from it. I found some
> tutorials on the old Papyrus site showing videos of the code generator
> (run via run configurations), but it appears to be unavailable in
> Eclipse Juno SR2. It is listed, but not discussed in the user's guide at:
>
> http://wiki.eclipse.org/Papyrus_User_Guide#C.2FC.2B.2B_Code_Generation
>
> Could someone please tell me what the status is of this capability? It
> is available now, planned for some future release or unplanned?
>
> Thanks!
>
> Jay
Re: Status of code generation in Papyrus? [message #1030305 is a reply to message #1030124] Sat, 30 March 2013 21:08 Go to previous messageGo to next message
Jay Billings is currently offline Jay Billings
Messages: 40
Registered: July 2011
Member
Ed,

Thanks very much! I'll definitely check that out for Java. Do you know of a way to do it for C++? As far as I know, the default EMF will not generate C++.

Jay


Jay Jay Billings
Oak Ridge National Laboratory
Twitter: @jayjaybillings
Re: Status of code generation in Papyrus? [message #1030682 is a reply to message #1030305] Sun, 31 March 2013 11:20 Go to previous messageGo to next message
Jay Billings is currently offline Jay Billings
Messages: 40
Registered: July 2011
Member
Everyone,

Most of my models will convert to ECore just fine, although I have one that won't. Oddly, the one that won't is the one I really want! I currently have it as part of a Papryus model and when I run the UML Editor -> Convert to -> Ecore Model operation it does not work. A .ecore file is not produced as in my other test cases. In the Error Log I get the warning posted below. Any thoughts? Should I report this as a bug?

Thanks,
Jay

----- Warning message -----

java.lang.reflect.InvocationTargetException
at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:479)
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:372)
at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:507)
at org.eclipse.uml2.examples.uml.ui.actions.ConvertToEcoreModelAction.run(ConvertToEcoreModelAction.java:168)
at org.eclipse.emf.edit.ui.action.CommandAction.runWithEvent(CommandAction.java:194)
at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:241)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1276)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3562)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3186)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1053)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:942)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:588)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:543)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
at org.eclipse.equinox.launcher.Main.main(Main.java:1414)


Caused by: java.lang.StackOverflowError
at org.eclipse.uml2.uml.util.UMLUtil$UML2EcoreConverter.caseTemplateParameter(UMLUtil.java:3361)
at org.eclipse.uml2.uml.util.UMLSwitch.doSwitch(UMLSwitch.java:2158)
at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:53)
at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:69)
at org.eclipse.uml2.uml.util.UMLUtil$UML2EcoreConverter.doSwitch(UMLUtil.java:3399)
at org.eclipse.uml2.uml.util.UMLUtil$UML2EcoreConverter.caseComment(UMLUtil.java:2800)
at org.eclipse.uml2.uml.util.UMLSwitch.doSwitch(UMLSwitch.java:404)
at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:53)
at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:69)
at org.eclipse.uml2.uml.util.UMLUtil$UML2EcoreConverter.doSwitch(UMLUtil.java:3399)
at org.eclipse.uml2.uml.util.UMLUtil$UML2EcoreConverter.defaultCase(UMLUtil.java:3389)
at org.eclipse.uml2.uml.util.UMLUtil$UML2EcoreConverter.caseTemplateParameter(UMLUtil.java:3361)
at org.eclipse.uml2.uml.util.UMLSwitch.doSwitch(UMLSwitch.java:2158)
at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:53)
at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:69)
at org.eclipse.uml2.uml.util.UMLUtil$UML2EcoreConverter.doSwitch(UMLUtil.java:3399)
at org.eclipse.uml2.uml.util.UMLUtil$UML2EcoreConverter.caseComment(UMLUtil.java:2800)
at org.eclipse.uml2.uml.util.UMLSwitch.doSwitch(UMLSwitch.java:404)
at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:53)
at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:69)
at org.eclipse.uml2.uml.util.UMLUtil$UML2EcoreConverter.doSwitch(UMLUtil.java:3399)
at org.eclipse.uml2.uml.util.UMLUtil$UML2EcoreConverter.defaultCase(UMLUtil.java:3389)
at org.eclipse.uml2.uml.util.UMLUtil$UML2EcoreConverter.caseTemplateParameter(UMLUtil.java:3361)
at org.eclipse.uml2.uml.util.UMLSwitch.doSwitch(UMLSwitch.java:2158)
at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:53)
at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:69)
at org.eclipse.uml2.uml.util.UMLUtil$UML2EcoreConverter.doSwitch(UMLUtil.java:3399)
at org.eclipse.uml2.uml.util.UMLUtil$UML2EcoreConverter.caseComment(UMLUtil.java:2800)
....

truncated for brevity, it just repeats


Jay Jay Billings
Oak Ridge National Laboratory
Twitter: @jayjaybillings
Re: Status of code generation in Papyrus? [message #1030719 is a reply to message #1030682] Sun, 31 March 2013 12:41 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 3842
Registered: July 2009
Senior Member
Hi

StackOverflowError is usually a coding bug; please submit a Bugzilla to
MDT/UML2.

The problem seems to be a TemplateParameter, which is not surprising
since they are quite challenging.

However at
org.eclipse.uml2.uml.util.UMLUtil$UML2EcoreConverter.caseComment(UMLUtil.java:2800)
suggests some kind of re-entrant templated comment; wierd concept.

Try deleting all your comments.

Regards

Ed Willink

On 31/03/2013 16:20, Jay Billings wrote:
> Everyone,
>
> Most of my models will convert to ECore just fine, although I have one
> that won't. Oddly, the one that won't is the one I really want! I
> currently have it as part of a Papryus model and when I run the UML
> Editor -> Convert to -> Ecore Model operation it does not work. A
> .ecore file is not produced as in my other test cases. In the Error
> Log I get the warning posted below. Any thoughts? Should I report this
> as a bug?
>
> Thanks,
> Jay
>
> ----- Warning message -----
>
> java.lang.reflect.InvocationTargetException
> at
> org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:479)
> at
> org.eclipse.jface.operation.ModalContext.run(ModalContext.java:372)
> at
> org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:507)
> at
> org.eclipse.uml2.examples.uml.ui.actions.ConvertToEcoreModelAction.run(ConvertToEcoreModelAction.java:168)
> at
> org.eclipse.emf.edit.ui.action.CommandAction.runWithEvent(CommandAction.java:194)
> at
> org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:241)
> at
> org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
> at
> org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
> at
> org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1276)
> at
> org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3562)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3186)
> at
> org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1053)
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
> at
> org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:942)
> at
> org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
> at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:588)
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:543)
> at
> org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
> at
> org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
> at
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1414)
>
>
> Caused by: java.lang.StackOverflowError
> at
> org.eclipse.uml2.uml.util.UMLUtil$UML2EcoreConverter.caseTemplateParameter(UMLUtil.java:3361)
> at org.eclipse.uml2.uml.util.UMLSwitch.doSwitch(UMLSwitch.java:2158)
> at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:53)
> at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:69)
> at
> org.eclipse.uml2.uml.util.UMLUtil$UML2EcoreConverter.doSwitch(UMLUtil.java:3399)
> at
> org.eclipse.uml2.uml.util.UMLUtil$UML2EcoreConverter.caseComment(UMLUtil.java:2800)
> at org.eclipse.uml2.uml.util.UMLSwitch.doSwitch(UMLSwitch.java:404)
> at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:53)
> at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:69)
> at
> org.eclipse.uml2.uml.util.UMLUtil$UML2EcoreConverter.doSwitch(UMLUtil.java:3399)
> at
> org.eclipse.uml2.uml.util.UMLUtil$UML2EcoreConverter.defaultCase(UMLUtil.java:3389)
> at
> org.eclipse.uml2.uml.util.UMLUtil$UML2EcoreConverter.caseTemplateParameter(UMLUtil.java:3361)
> at org.eclipse.uml2.uml.util.UMLSwitch.doSwitch(UMLSwitch.java:2158)
> at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:53)
> at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:69)
> at
> org.eclipse.uml2.uml.util.UMLUtil$UML2EcoreConverter.doSwitch(UMLUtil.java:3399)
> at
> org.eclipse.uml2.uml.util.UMLUtil$UML2EcoreConverter.caseComment(UMLUtil.java:2800)
> at org.eclipse.uml2.uml.util.UMLSwitch.doSwitch(UMLSwitch.java:404)
> at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:53)
> at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:69)
> at
> org.eclipse.uml2.uml.util.UMLUtil$UML2EcoreConverter.doSwitch(UMLUtil.java:3399)
> at
> org.eclipse.uml2.uml.util.UMLUtil$UML2EcoreConverter.defaultCase(UMLUtil.java:3389)
> at
> org.eclipse.uml2.uml.util.UMLUtil$UML2EcoreConverter.caseTemplateParameter(UMLUtil.java:3361)
> at org.eclipse.uml2.uml.util.UMLSwitch.doSwitch(UMLSwitch.java:2158)
> at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:53)
> at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:69)
> at
> org.eclipse.uml2.uml.util.UMLUtil$UML2EcoreConverter.doSwitch(UMLUtil.java:3399)
> at
> org.eclipse.uml2.uml.util.UMLUtil$UML2EcoreConverter.caseComment(UMLUtil.java:2800)
> ....
>
> truncated for brevity, it just repeats
Re: Status of code generation in Papyrus? [message #1030855 is a reply to message #1030719] Sun, 31 March 2013 17:59 Go to previous messageGo to next message
Jay Billings is currently offline Jay Billings
Messages: 40
Registered: July 2011
Member
Ed,

The template parameter had a comment on it. I removed the comment as you suggested and it worked (after moving one other erroneously placed class).

Thanks for you help!

Jay


Jay Jay Billings
Oak Ridge National Laboratory
Twitter: @jayjaybillings
Re: Status of code generation in Papyrus? [message #1031220 is a reply to message #1030855] Mon, 01 April 2013 07:26 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 3842
Registered: July 2009
Senior Member
Hi

Can you recreate the bad comment in a trivial example and submit it as a
Bugzilla please.

Regards

Ed Willink


On 31/03/2013 22:59, Jay Billings wrote:
> Ed,
>
> The template parameter had a comment on it. I removed the comment as
> you suggested and it worked (after moving one other erroneously placed
> class).
>
> Thanks for you help!
>
> Jay
Re: Status of code generation in Papyrus? [message #1035918 is a reply to message #1030682] Sun, 07 April 2013 13:14 Go to previous messageGo to next message
Fabio Crespa Polacci is currently offline Fabio Crespa Polacci
Messages: 2
Registered: April 2013
Junior Member
Jay Billings wrote on Sun, 31 March 2013 11:20
Everyone,

Most of my models will convert to ECore just fine


Please, I'm using Eclipse Juno with Papyrus 0.9.2 but cannot find any recent documentation which explains how to generate code (C++/Java) using UML models that have been designed in Papyrus.

Can you tell me how do this or at least how can I convert the .di file into an ecore file? Is the UML Editor an additional plugin?

Thanks a lot,
Fabio
Re: Status of code generation in Papyrus? [message #1052945 is a reply to message #1035918] Wed, 01 May 2013 10:13 Go to previous messageGo to next message
Goood Guy is currently offline Goood Guy
Messages: 124
Registered: September 2011
Senior Member
Hi

you can generate code from UML class diagrams this way:
* create the class diagram in Papyrus
* choose "file > new > other > EMF Project"
* Enter project name
* Select "UML model"
* Select your uml file from your workspace
* hit finish

run the code generation from the .genmodel (more details in EMF forum)
Re: Status of code generation in Papyrus? [message #1052987 is a reply to message #1052945] Wed, 01 May 2013 13:39 Go to previous messageGo to next message
Fabio Crespa Polacci is currently offline Fabio Crespa Polacci
Messages: 2
Registered: April 2013
Junior Member
Thank you Guy,
it worked well! Smile
Re: Status of code generation in Papyrus? [message #1061396 is a reply to message #1030018] Fri, 31 May 2013 09:05 Go to previous messageGo to next message
Cedric Dumoulin is currently offline Cedric Dumoulin
Messages: 34
Registered: July 2009
Member
Hi,

If you want to generate Java skeleton, there is also an experimental
Java code generator in the additional features or Papyrus.

You can get the source code from the svn repository
modeling/org.eclipse.mdt.papyrus/trunk/extraplugins/java,

or
try the update site (for kepler):
-
http://www.lifl.fr/~dumoulin/papyrus-update/org.eclipse.papyrus.java-updatesite/

There is also an experimental Java code reverse tool.

The previous plugins should be available from Papyrus adititional
features soon.

Cedric

Jay Billings a écrit :
> Everyone,
>
> I have imported a UML model from IBM Rational Software Architect into
> Papyrus and I would like to generate code from it. I found some
> tutorials on the old Papyrus site showing videos of the code generator
> (run via run configurations), but it appears to be unavailable in
> Eclipse Juno SR2. It is listed, but not discussed in the user's guide at:
>
> http://wiki.eclipse.org/Papyrus_User_Guide#C.2FC.2B.2B_Code_Generation
>
> Could someone please tell me what the status is of this capability? It
> is available now, planned for some future release or unplanned?
>
> Thanks!
>
> Jay
Re: Status of code generation in Papyrus? [message #1064976 is a reply to message #1061396] Sat, 22 June 2013 06:50 Go to previous messageGo to next message
Low Coupling is currently offline Low Coupling
Messages: 31
Registered: June 2013
Member
In my opinion the best way to generate text (i.e. code) from your UML models (actually any model instance of an ECORE defined meta-model) is using MOFM2T transformations which in Eclipse are provided by the Acceleo plugin.

See

http://lowcoupling.com/post/47347056110/models-to-text-transformations-with-mofm2t-and-acceleo
http://lowcoupling.com/dslengineering
http://lowcoupling.com/modeling


interested on Eclipse, DSL and MDA? Visit http://www.lowcoupling.com

[Updated on: Sat, 22 June 2013 06:51]

Report message to a moderator

Re: Status of code generation in Papyrus? [message #1064977 is a reply to message #1064976] Sat, 22 June 2013 07:47 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 3842
Registered: July 2009
Senior Member
Hi

AFAIK the Acceleo transformations have no support generating Java code
for embedded OCL, so you will incur the compilation costs lazily on each
first use, and interpretation overheads on every use.

In contrast, using the UML2Ecore2Java route can give you Java code for
your OCL in Kepler.

Regards

Ed Willink


On 22/06/2013 11:50, Low Coupling wrote:
> In my opinion the best way to generate text (i.e. code) from your UML
> models (actually any model instance of an ECORE defined meta-model) is
> using MOFM2T transformations which in Eclipse are provided by the
> Acceleo plugin.
>
> See
>
> http://lowcoupling.com/post/47347056110/models-to-text-transformations-with-mofm2t-and-acceleo
>
> http://lowcoupling.com/dslengineering
> http://lowcoupling.com/mda
>
Re: Status of code generation in Papyrus? [message #1066935 is a reply to message #1052945] Fri, 05 July 2013 04:15 Go to previous messageGo to next message
Stefan Eidelloth is currently offline Stefan Eidelloth
Messages: 27
Registered: September 2011
Junior Member
Goood Guy wrote on Wed, 01 May 2013 10:13
Hi

...
* choose "file > new > other > EMF Project"
...
run the code generation from the .genmodel (more details in EMF forum)


What eclipse version and update sites do you recommend to do so?
I am a newbe and tried to install EMF-Core on Kepler with an update site
but it did not work.

I am looking for a round trip solution for UML modeling of java in eclipse.
I like Green UML (it is the most intuitive I could find until now) but it
is out of date and has some other issues, too. The java code generation feature
for papyrus looks very promising in the old documentation. Does somebody
know a tutorial for roundtrip UML modeling of java with papyrus (and additional
eclipse plugins)?
If this is not possible, do you know a free alternative that is up to date?
I tried the free UML editors from this overview and I am kind of stuck now:
http://wiki.eclipse.org/MDT-UML2-Tool-Compatibility

Sunny regards

[Updated on: Fri, 05 July 2013 04:18]

Report message to a moderator

Re: Status of code generation in Papyrus? [message #1066954 is a reply to message #1066935] Fri, 05 July 2013 04:51 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 3842
Registered: July 2009
Senior Member
Hi

Rather than striuggle with wring update sites, why not just start with

http://www.eclipse.org/downloads/packages/eclipse-modeling-tools/keplerr

so that you get all the basic modeling stuff pre-installed?

The modeling discovery wizard in the Help menu and on the tool bar helps
you with any further modeling tools.

Regards

Ed Willink


On 05/07/2013 09:15, Stefan Eidelloth wrote:
> Goood Guy wrote on Wed, 01 May 2013 10:13
>> Hi
>>
>> ...
>> * choose "file > new > other > EMF Project"
>> ...
>> run the code generation from the .genmodel (more details in EMF forum)
>
>
> What eclipse version and update sites do you recommend to do so?
> I am a newbe and tried to install EMF-Core on Kepler with an update site
> but it did not work.
>
> I am looking for a round trip solution for UML modeling of java in
> eclipse.
> I like Green UML but it is out of date, too. The java code generation
> feature
> for papyrus looks very promising in the old documentation. Does somebody
> know a tutorial for roundtrip UML modeling of java with papyrus (and
> additional
> eclipse plugins)?
> If this is not possible, do you know a free alternative that is up to
> date?
> I tried these and I am kind of stuck now:
> http://wiki.eclipse.org/MDT-UML2-Tool-Compatibility
> Sunny regards
Re: Status of code generation in Papyrus? [message #1067046 is a reply to message #1066954] Fri, 05 July 2013 11:13 Go to previous messageGo to next message
Stefan Eidelloth is currently offline Stefan Eidelloth
Messages: 27
Registered: September 2011
Junior Member
Ok, thanks a lot.

Here is a description of how far I got now
(example files are attached as zipped project):

1. Create Java Project

2. Create Papyrus UML Model: file > new > other > Papyrus > Papyrus Model
* choose UML as diagram language
* choose the option "UML Class Diagram" to create a class diagram
* open model.di and add some classes to the diagram with the tools in "Palette"

3. Save model.di (The following step did not work for me without saving.)

4. Create Ecore Generator Model from Papyrus UML Model
* right click on model.di and select
* "new > other > Eclipse Modeling Framework > EMF Generator Model"
* Select "UML model"
* Select the model.uml file that was created by papyrus from your workspace

5. Generate Java Code
+ Open model.genmodel and select the root node
+ Right click and select "Generate Model Code"

=> some code is generated in the src folder

----------------------------

So far, so good. Some questions are left:

- If I make changes to the papyrus file model.di, how can I update the ecore model?
+ Do I have to manually create it new or
+ can I do something like "update ecore from uml source" or
+ is there something like an "auto update" - feature?

- If I change the generated code in the src-folder, how do I automatically update the uml model and the ecore model to include new classes?

------------
Edit:

I found some links about automation with ant or maven:

Ant:
http://cubussapiens.hu/2010/12/generating-java-code-from-emf-models-automatically
http://www.eclipse.org/forums/index.php?t=msg&th=129660/

Maven:
http://www.eclipse.org/forums/index.php?t=msg&th=134237
http://mapasuta.sourceforge.net/maven/site/maven-emfgen-plugin/genmodel-mojo.html

Quote:
The previous plugins should be available from Papyrus adititional
features soon.


=> Should I try to go on with ant/maven our with the tool from Cedric Dumoulin mentioned above (his update site does not seem to work)? Any further alternatives?


[Updated on: Sat, 06 July 2013 04:13]

Report message to a moderator

- [message #1067126 is a reply to message #1067046] Sat, 06 July 2013 02:09 Go to previous messageGo to next message
Stefan Eidelloth is currently offline Stefan Eidelloth
Messages: 27
Registered: September 2011
Junior Member
No Message Body

[Updated on: Sat, 06 July 2013 02:20]

Report message to a moderator

Re: Status of code generation in Papyrus? [message #1069774 is a reply to message #1066954] Tue, 16 July 2013 10:27 Go to previous messageGo to next message
Tahar gh is currently offline Tahar gh
Messages: 9
Registered: September 2012
Junior Member
Hi Ed.

thanks for your replies concerning papyrus use!

I still have a question: if we elaborate a profile (defining stereotypes for classes and actions) with papyrus and use it to construct models (class diagrams and state-machines, both containing stereotypes), how can one generate java code from the etablished models (I mean from stereotyped class diagrams and statemachines)?

thank you in advance
Re: Status of code generation in Papyrus? [message #1069840 is a reply to message #1069774] Tue, 16 July 2013 13:32 Go to previous message
Ed Willink is currently offline Ed Willink
Messages: 3842
Registered: July 2009
Senior Member
Hi

In principle the standard

define your UML models (see OCL in UML (using Papyrus) in the OCL
Documentation
create/use your genmodel

should just work. If you want embedded OCL to be code generated rather
than interpreted

see "Code Generation tutorial" in the OCL Documentation

Regards

Ed Willink

On 16/07/2013 15:27, Tahar gh wrote:
> Hi Ed.
>
> thanks for your replies concerning papyrus use!
>
> I still have a question: if we elaborate a profile (defining
> stereotypes for classes and actions) with papyrus and use it to
> construct models (class diagrams and state-machines, both containing
> stereotypes), how can one generate java code from the etablished
> models (I mean from stereotyped class diagrams and statemachines)?
>
> thank you in advance
Previous Topic:linking structural and behavioral diagrams
Next Topic:Customized Palette for Stereotypes with String Properties
Goto Forum:
  


Current Time: Thu Apr 17 11:39:28 EDT 2014

Powered by FUDForum. Page generated in 0.02261 seconds