|
Re: [Acceleo] Problem when generating code with GMF [message #631432 is a reply to message #631425] |
Thu, 07 October 2010 14:21 |
|
This is a multi-part message in MIME format.
--------------080602000608010301070204
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Hi Cedric,
Acceleo doesn't alter the model it generates code for, yet it does try
and find back the EPackageFactories it needs to use when deserializing
module files.
In your use case, this step might not be necessary. As I don't have any
environment with GMF at hand, would you have any way to retrieve the
Acceleo code source and try a little patch (so that I know whether this
is the only problem :p)?
Namely, I believe that changing
org.eclipse.acceleo.engine.internal.environment.AcceleoEnvir onment#restoreBrokenEnvironmentPackages()
(line 97) from
if (factory != null) {
to
if (factory != null && ((EPackage)element).getEFactoryInstance() !=
factory) {
would be enough to stop us from wrecking havock in that use case :).
Whether you can try it yourself or not, could you raise a bugzilla entry
for this issue?
Laurent Goubet
Obeo
Cedric wrote:
> Hello,
>
> I'm trying to integrate Acceleo in a GMF editor to be able to generate
> code from the active editor.
> For this, I created a new action this way:
>
> public class Model2CodeAction extends Action {
>
> private final IWorkbenchWindow window;
>
> public Model2CodeAction(IWorkbenchWindow window) {
> this.window = window;
> setText("Generate code");
> setId("Model2CodeAction");
> }
>
> @Override
> public void run() {
> IEditorPart activeEditor =
> window.getActivePage().getActiveEditor();
> if (activeEditor == null) {
> return;
> }
> if (!(activeEditor instanceof PLCOpenEditorDiagramEditor)) {
> return;
> }
>
> PLCOpenEditorDiagramEditor diagramEditor =
> (PLCOpenEditorDiagramEditor) activeEditor;
> EObject modelElement = diagramEditor.getDiagram().getElement();
> try {
> Generate generator = new Generate(modelElement,
> new File("c:\\temp"), new LinkedList());
> generator.doGenerate(null);
> } catch (Exception e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> }
>
> }
>
> The action is registered in the GMF editor and appears properly. The
> problem occurs when I execute the action: an exception is thrown which
> says "Cannot modify resource set without a write transaction".
>
> Here is the full stack trace:
> java.lang.IllegalStateException: Cannot modify resource set without a
> write transaction
> at
> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ssertWriting(TransactionChangeRecorder.java:348)
>
> at
> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ppendNotification(TransactionChangeRecorder.java:302)
>
> at
> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.p rocessObjectNotification(TransactionChangeRecorder.java:284)
>
> at
> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.n otifyChanged(TransactionChangeRecorder.java:240)
>
> at
> org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify (BasicNotifierImpl.java:380)
>
> at
> org.eclipse.emf.common.notify.impl.NotificationImpl.dispatch (NotificationImpl.java:1033)
>
> at
> org.eclipse.emf.ecore.impl.EPackageImpl.setEFactoryInstance( EPackageImpl.java:385)
>
> at
> org.eclipse.acceleo.engine.internal.environment.AcceleoEnvir onment.restoreBrokenEnvironmentPackages(AcceleoEnvironment.j ava:102)
>
> at
> org.eclipse.acceleo.engine.internal.environment.AcceleoEnvir onmentFactory.createEnvironment(AcceleoEnvironmentFactory.ja va:93)
>
> at org.eclipse.ocl.OCL.<init>(OCL.java:101)
> at org.eclipse.ocl.ecore.OCL.<init>(OCL.java:89)
> at org.eclipse.ocl.ecore.OCL.newInstance(OCL.java:144)
> at
> org.eclipse.acceleo.engine.generation.AcceleoEngine.evaluate (AcceleoEngine.java:127)
>
> at
> org.eclipse.acceleo.engine.service.AcceleoService.doGenerate Template(AcceleoService.java:544)
>
> at
> org.eclipse.acceleo.engine.service.AcceleoService.doGenerate (AcceleoService.java:380)
>
> at
> org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator. generate(AbstractAcceleoGenerator.java:120)
>
> at
> org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator. doGenerate(AbstractAcceleoGenerator.java:99)
>
> at
> be.fmtc.savarch.PLCOpenEditor.Model2Code.files.Generate.doGe nerate(Generate.java:148)
>
> at
> PLCOpenEditor.diagram.custom.Model2CodeAction.run(Model2Code Action.java:41)
> at org.eclipse.jface.action.Action.runWithEvent(Action.java:498 )
> at
> org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:584)
>
> at
> org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:501)
>
> at
> org.eclipse.jface.action.ActionContributionItem$5.handleEven t(ActionContributionItem.java:411)
>
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:4066)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3657)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2629)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:24 27)
> at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:332)
>
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:663)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
> at
> PLCOpenEditor.diagram.application.PLCOpenEditorApplication.s tart(PLCOpenEditorApplication.java:23)
>
> at
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.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(EclipseS tarter.java:369)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:179)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
>
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:597)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 619)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
>
>
> Does Acceleo try to modify the model for which it should generate the
> code ? I don't know how to fix this problem.
--------------080602000608010301070204
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"
YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------080602000608010301070204--
|
|
|
|
Re: [Acceleo] Problem when generating code with GMF [message #631596 is a reply to message #631587] |
Fri, 08 October 2010 06:35 |
|
This is a multi-part message in MIME format.
--------------040408010207030909030707
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Hi Cedric,
Yep, GMF is free of charge here, the problem is that we've never tried
to launch Acceleo generations in the particular use case you are in :
using models located in a resource set in which OCL is already loaded
and under transaction management. That's just one more unit test we
should implement ^^.
Laurent Goubet
Obeo
Cedric wrote:
> Hi Laurent,
>
> Thanks for the quick answer. I'll take a look at it to see what I can do.
> Anyway, now that I thnik of it, GMF is not really part of the problem
> anymore: I am retrieving the model from a GMF diagram and pass this EMF
> model to the Acceleo engine. Thus, GMF has probably nothing to do with it.
--------------040408010207030909030707
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"
YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------040408010207030909030707--
|
|
|
|
Re: [Acceleo] Problem when generating code with GMF [message #631622 is a reply to message #631600] |
Fri, 08 October 2010 08:34 |
|
This is a multi-part message in MIME format.
--------------090805080203040407090408
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Humm, Are the exception stack traces the same with my suggestion and
without? I don't recall us "set"ting anything on the models other than
at that point in the code.
Laurent Goubet
Obeo
Cedric wrote:
> Hello Laurent,
>
> I submitted a bug report in bugzilla about the case.
> I also tried your suggestion but it doesn't solve the problem, the same
> issue happens. I also tried to remove the line
> ((EPackage)element).setEFactoryInstance(factory); to see what happens
> but the problem still persists.
--------------090805080203040407090408
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"
YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------090805080203040407090408--
|
|
|
|
Re: [Acceleo] Problem when generating code with GMF [message #631729 is a reply to message #631635] |
Fri, 08 October 2010 14:13 |
|
This is a multi-part message in MIME format.
--------------030700030606060601020907
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Could you provide us with a minimal example of what you're trying to do
on the bugzilla you opened? The plug-in where you define the "generate"
action on GMF objects? Being able to debug would allow me to understand
what Acceleo tries to do on the model that would require a transaction.
Laurent Goubet
Obeo
Cedric wrote:
> Yes, the stack trace is exactly the same. In fact when I debug the code,
> the problem doesn't occur at that place but a bit later, in the
> doEvaluate method of the AcceleoEngine. The code fails when trying to
> evaluate the OCL query in the doEvaluate method of the AcceleoEngine.
--------------030700030606060601020907
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"
YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------030700030606060601020907--
|
|
|
|
Re: [Acceleo] Problem when generating code with GMF [message #632225 is a reply to message #632018] |
Tue, 12 October 2010 07:44 |
|
This is a multi-part message in MIME format.
--------------070600060005030905000709
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Hi Cedric,
Thanks, I'll try and get this test environment running to see what's
Acceleo trying to do here. This is not our priority though, but I'll try
and have this fixed for 3.0.2 and 3.1.0M3.
Laurent Goubet
Obeo
Cedric wrote:
> Hello Laurent,
>
> I've added some plug-ins on the bugzilla. They are needed to be able to
> test the problem. Please note that there is also a configuration file
> attached to the bugzilla. This file has to be placed in the runtime
> directory.
>
> Thanks
--------------070600060005030905000709
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"
YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------070600060005030905000709--
|
|
|
|
Re: [Acceleo] Problem when generating code with GMF [message #639336 is a reply to message #639200] |
Tue, 16 November 2010 07:52 |
|
Hi Cedric,
Unfortunately, I can't give you a more precise date than what I previously told :
Quote: | I'll try and have this fixed for 3.0.2 and 3.1.0M3.
|
3.0.2 is due the 25th of february ... 3.1.0M3 is already past yet the fix for this hasn't made it in this milestone. I hope I can take a look at this bug before M4 (17th of december), yet I can't promise I will as it isn't our priority as far as the current developments are concerned : stabilization of our dynamic models support is.
If you really need this fixed ASAP, feel free to debug the various issues you encounter where Acceleo tries and modify the models, and prevent it to do so (the "getEFactoryInstance != factory" line I gave you previously is a start, but I believe there are other locations in the code where we try and do such modifications (which would explain why you get an exception even with this fix). This isn't our priority now, but a patch will always be looked at way faster than a bug .
Laurent Goubet
Obeo
|
|
|
Powered by
FUDForum. Page generated in 0.04809 seconds