Home » Archived » M2M (model-to-model transformation) » [QVTo] integrate a QVTo file into a GMF Editor
|
Re: [QVTo] integrate a QVTo file into a GMF Editor [message #556607 is a reply to message #556515] |
Thu, 02 September 2010 06:11 |
Eclipse User |
|
|
|
Originally posted by: dhendriksREMOVE_THIS.tueREMOVE.THIS.nl
Hello Pablo,
Loading and saving is not QVTo specific. Just use normal EMF
loading/saving. If you have trouble with this, please contact the EMF
newsgroup.
In order to do stuff on load and save, you some Java code in the
load/save methods. For instance, for my cifg language, I have a file
'cifg2.1.1.diagram/src/cifg/diagram/part/CifgDocumentProvide r.java'
(generated by GMF), where there is a 'doSaveDocument' method. In that
method I added some code to 'validate on save'. You should be able to do
a QVTo transformation there as well. Don't forget to mark the method
'generated NOT'. For more information, please contact the GMF newsgroup.
As for calling QVTo transformations from Java, see here:
http://wiki.eclipse.org/QVTOML/Examples/InvokeInJava
Hope this helps,
Dennis
Pablo Nieto wrote:
> Hello, I would like to know how to integrate a QVTo trasmformation into
> a GMF editor.
>
> I would like to execute the transformation when I open a diagram, and
> when I close it. This is the idea:
>
> Save diagram (standard model) -> open the diagram -> convert to my own
> model-> edit It -> close the diagram -> convert to standard model-> save
> it according to the standard model.
>
> How can I do that??
>
> Thanks, Pablo
|
|
| |
Re: [QVTo] integrate a QVTo file into a GMF Editor [message #556693 is a reply to message #556666] |
Thu, 02 September 2010 10:57 |
Eclipse User |
|
|
|
Originally posted by: dhendriksREMOVE_THIS.tueREMOVE.THIS.nl
Hello Pablo,
> I,ve been seing the doSaveDocument method, and it is too extensive.
> Where I should add the transformation code???
As I stated before, this is GMF related. Please ask this question in the
GMF newsgroup (eclipse.modeling.gmf) instead of the model to model
newsgroup (this one).
> In other side, I´ve seen the URL
> (http://wiki.eclipse.org/QVTOML/Examples/InvokeInJava) and some of the
> classes that this code uses, can´t be imported, and I don´t know how
> to use the code well.
You obviously need to add some plug-ins to the required plug-ins list of
the MANIFEST.MF file. In one of my manifests where I do QVTo
transformations in Java, I have this:
org.eclipse.m2m.qvt.oml;bundle-version="3.0.0",
org.eclipse.m2m.qvt.oml.common;bundle-version="2.1.0",
org.eclipse.m2m.qvt.oml.runtime;bundle-version="2.1.0",
org.eclipse.m2m.qvt.oml.emf.util;bundle-version="2.0.100",
org.eclipse.m2m.qvt.oml.ocl;bundle-version="2.1.0",
The code example has quite a lot of comments. Your question is not
specific enough to give additional information. The code example shows
how to run QVTo transformations in Java, so you should simply adapt it
to your situation. If you have specific questions, they can be answered.
Note that the Resource and URI classes are not part of the QVTo
implementation; they are part of EMF.
You can also look at API documentation. For instance, if you don't
understand the TransformationExecutor class, google for it, and you find:
http://ftp.kaist.ac.kr/eclipse/modeling/m2m/qvtoml/javadoc/m 2m.qvt.oml/3.0.0/org/eclipse/m2m/qvt/oml/TransformationExecu tor.html
Which gives you more information. I think the Eclipse Java environment
can also give you this information using content assist (ctrl+space).
Best,
Dennis
Pablo Nieto wrote:
>
> Helllo.
>
> I,ve been seing the doSaveDocument method, and it is too extensive.
> Where I should add the transformation code???
> In other side, I´ve seen the URL
> (http://wiki.eclipse.org/QVTOML/Examples/InvokeInJava) and some of the
> classes that this code uses, can´t be imported, and I don´t know how to
> use the code well.
>
> Do you have any idea?
>
> Thanks, Pablo.
|
|
| |
Re: [QVTo] integrate a QVTo file into a GMF Editor [message #556701 is a reply to message #556696] |
Thu, 02 September 2010 11:37 |
Eclipse User |
|
|
|
Originally posted by: dhendriksREMOVE_THIS.tueREMOVE.THIS.nl
Hello Pablo,
Comments below.
Dennis
Pablo Nieto wrote:
> Hello I´ve installed all the plugins.
>
> I have copied the code from the url
> (http://wiki.eclipse.org/QVTOML/Examples/InvokeInJava). Now there is
> one error still.
> In this sentence:
> Resource inResource = resourceSet.getResource(
>
> URI.createURI("platform:/resources/myqvtprj/today.world"), true);
>
> the field resourceSet doesn´t exist in the DocumentProvider class.
resourceSet is not a field, it is supposed to be a variable. The easiest
way to create one, is like this:
ResourceSet resourceSet = new ResourceSetImpl();
This is all standard EMF. Maybe it would be a good idea to study the EMF
apis...? You can't expect to code custom code into your GMF generated
editor, without studying the APIs you are programming against...
> What should I Do?
> In the doSaveDocument method, Wher do I have to add the code?
One again (for the 3rd time!), this is NOT a QVTo question, but a GMF
question. Please ask this question on the GMF newsgroup instead!
> thanks
>
>
|
|
|
Goto Forum:
Current Time: Fri Apr 26 09:55:58 GMT 2024
Powered by FUDForum. Page generated in 0.03584 seconds
|