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: 36
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: 3191
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: 36
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: 36
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: 3191
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: 36
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: 3191
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: 98
Registered: September 2011
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 message
Fabio Crespa Polacci is currently offline Fabio Crespa Polacci
Messages: 2
Registered: April 2013
Junior Member
Thank you Guy,
it worked well! Smile
Previous Topic:Import UML to Papyrus
Next Topic:Horizontal Instead of Vertically Oriented Regions for States in State Machine Diagrams
Goto Forum:
  


Current Time: Tue May 28 16:50:29 EDT 2013

Powered by FUDForum. Page generated in 0.01777 seconds