Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Ecore2Java: differences with the GenModel context menu?
Ecore2Java: differences with the GenModel context menu? [message #479230] Mon, 10 August 2009 11:23 Go to next message
Eclipse UserFriend
Originally posted by: nyoescape.gmail.com

Hello all,

I'm probably doing something wrong, but there appear to be some
differences between how the Ecore2Java Ant task and the "Generate X
Model" EMF context menu entries work. I'm not sure if they are
intentional or not. Let me list them:

- the paths in the "editProject", "editorProject" and "testProject"
arguments and the "modelproject" attribute seem to be relative paths
from the current directory, which I can't control, since I have to use
the same JRE as the IDE, due to other reasons.

If I try to use an absolute path to a subdirectory of the workspace, I
get an "overlapping path" error message to the effect of
"/home/user/workspace/MyModel.edit overlaps with the existing
MyModel.edit project" (which does not exist yet). To make it work, I
have to use something different, like
"/home/user/workspace/generated/MyModel.edit".

The generated .gemodel has the previous absolute paths in the
editDirectory, editorDirectory and testDirectory attributes. To
produce code using the "Generate X Model" context menu entries from
it, I have to change them to workspace paths, or they create

If possible, I'd like the Ant task to use workspace paths as well (but
this probably requires changes to the code), or avoid those
path overlap errors.

- even if I pass the -testProjects argument, the tests project is not
generated, as in the "Generate Tests Project" context menu entry.

- the edit and editor projects are correctly generated and appear in my
workspace, but they do not have the Java and PDE natures assigned to
them. Their .project files contain the bare minimum (name and empty
buildSpec and nature elements), and they don't have any .classpath
files. However, when generating them from the context menu, they work
just fine.

I'm using the Ecore2Java task like this:

<emf.Ecore2Java model="model/mymodel.ecore"
genmodel="model/mymodel.genmodel"
modelproject="${basedir}"
modelProjectFragmentPath="src" modelPluginID="MyModel">
<arg line="-editProject ${basedir}/../generated/MyModel.edit src" />
<arg line="-editorProject ${basedir}/../generated/MyModel.editor src" />
<arg line="-testsProject ${basedir}/../generated/MyModel.tests src" />
</emf.Ecore2Java>

Thanks in advance,
Antonio
Re: Ecore2Java: differences with the GenModel context menu? [message #479294 is a reply to message #479230] Mon, 10 August 2009 15:37 Go to previous messageGo to next message
Marcelo Paternostro is currently offline Marcelo PaternostroFriend
Messages: 602
Registered: July 2009
Senior Member
Hi Antonio,

The EMF tasks are not designed to be used with the UI actions. Their goal is to provide the means to generate the artifacts in situations in which the Ui is not available. It is possible to change the code to provide this support. Feel free to open a feature request, remembering that this will be probably be a low priority at this moment.

One very important constraint to run the EMF Ant tasks (or the EMF headless applications on which the tasks rely) is that they should not be generating artifacts in the workspace of the Eclipse that is running them. In other words, when running your scripts, make sure the -data option of your command line (or the workspace of the launcher) points to a different directory.

Respecting the constraint above, I was able to generate the code that I believe you are looking for. One detail: the edit and editor projects are not added to the workspace in which your UI is running (remember that the Ant tasks are working on a different one).

Unfortunately there are indeed a few problems:

- The .classpath of the model project was not created with the PDE class path container

- As you've noticed, the .project files of the edit and editor projects were not created

- As you've noticed the test projects were not created

I will fix these as soon as possible. Would you mind opening one defect for each problem?

I am attaching here a zip with the project that I used to generate code. I includes a launcher (Eclipse Ant Runner) that will run the Ant script that is selected in the navigator/explorer.

Cheers,
Marcelo
Re: Ecore2Java: differences with the GenModel context menu? [message #479297 is a reply to message #479294] Mon, 10 August 2009 15:39 Go to previous messageGo to next message
Marcelo Paternostro is currently offline Marcelo PaternostroFriend
Messages: 602
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------020506020908090406060707
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

The web UI didn't attach the file... Let me try it again

Marcelo Paternostro wrote:
> Hi Antonio,
>
> The EMF tasks are not designed to be used with the UI actions. Their
> goal is to provide the means to generate the artifacts in situations
> in which the Ui is not available. It is possible to change the code to
> provide this support. Feel free to open a feature request, remembering
> that this will be probably be a low priority at this moment.
>
> One very important constraint to run the EMF Ant tasks (or the EMF
> headless applications on which the tasks rely) is that they should not
> be generating artifacts in the workspace of the Eclipse that is
> running them. In other words, when running your scripts, make sure the
> -data option of your command line (or the workspace of the launcher)
> points to a different directory.
>
> Respecting the constraint above, I was able to generate the code that
> I believe you are looking for. One detail: the edit and editor
> projects are not added to the workspace in which your UI is running
> (remember that the Ant tasks are working on a different one).
>
> Unfortunately there are indeed a few problems:
>
> - The .classpath of the model project was not created with the PDE
> class path container
>
> - As you've noticed, the .project files of the edit and editor
> projects were not created
>
> - As you've noticed the test projects were not created
>
> I will fix these as soon as possible. Would you mind opening one
> defect for each problem?
>
> I am attaching here a zip with the project that I used to generate
> code. I includes a launcher (Eclipse Ant Runner) that will run the Ant
> script that is selected in the navigator/explorer.
>
> Cheers,
> Marcelo

--------------020506020908090406060707
Content-Type: application/octet-stream;
name="mymodel.zip"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="mymodel.zip"

UEsDBBQACAAIAINcCjsAAAAAAAAAAAAAAAAQAAAATXlNb2RlbC8ucHJvamVj dLOxr8jNUShL
LSrOzM+zVTLUM1BSSM1Lzk/JzEu3VQoNcdO1ULK34+WyKSjKz0pNLnFJLU4u yiwoAaoGinLa
5CXmptr5Vvrmp6Tm2OiDeSDh5Pzc3NS8EjsbfRgLJAo1oxjM0UfhJZVm5qQE F6QmQ+RQuXmJ
JaVFqVBtCA7cCFRHAQBQSwcIIXqYioIAAADTAAAAUEsDBBQACAAIAINcCjsA AAAAAAAAAAAA
AAAhAAAATXlNb2RlbC9FY2xpcHNlIEFOVCBydW5uZXIubGF1bmNonVXbbtpA EH2v1H+wrLx6
nTSt1IfQyEpoWikBREhaqa2sZXewt6x3rb3goIh/zxgIQdRxoE/g8ZyZc+bm s/OHQgYzMFZo
1QlPyHEYgGKaC5V1wrvR1+hzeP7l/bszSb1i+YVWE5F5Qx26B25eQifUJiPA pCgtkJID8YIM
vXKigB/aTMcYLQ/rCGOtJVCVOGfE2DsIpjDvhLQsQXFCTWbDYEalx4jOeAjj GmPRV2X/QqRg
SwobyDYJqhxh2iz/IBMFZhXsFQJ2ytBsGrK/AvBOF5idJZwfDrqnUnDqYIOc UGnb1GI8hy9o
uUG0OLMc2BReaP3q9XvdP23EltpXbd1bzBJTNfWr1V/qbG/VbMnoWu+0+e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AXe0WwYVk2gV4GdG991nAWFEU XaOSrrEJe3+b
0TPENSHFY4UY9Hp9hM1XYg+Kd6R2nmsBDfbKSaMZRCozBxUDqLhkGbBJCaNE c4XgVG4tt6ea
R7vNctZkOHKVpeAqijMYcQsLsTxW/XRYNofwknLnZCxxeIJTBP6UoUAdT3V5 Fp3XPMMv1RBW
3ubC55anU+B4wjcMz95buc39xXq545usr0Gv3POyQH4UwgNjE5TGF6XsLi9L iMFCmX/tZWvM
AcfLswzs2OR6F9FOvw61XLVLFBwjkhJhtOdSK9A+oigItYGQXcd4d7AV+e9S 9dKn/xXrjZkd
OGFl5vEz/bGlm6Cx0PjIWPoEUEsHCPgmkv5qAQAAAwQAAFBLAQIUABQACAAI AINcCjshepiK
ggAAANMAAAAQAAAAAAAAAAAAAAAAAAAAAABNeU1vZGVsLy5wcm9qZWN0UEsB AhQAFAAIAAgA
g1wKO8gk+7RVAgAAhAcAACEAAAAAAAAAAAAAAAAAwAAAAE15TW9kZWwvRWNs aXBzZSBBTlQg
cnVubmVyLmxhdW5jaFBLAQIUABQACAAIAINcCjtReK0q5wAAAAQCAAAUAAAA AAAAAAAAAAAA
AGQDAABNeU1vZGVsL2dlbmVyYXRlLnhtbFBLAQIUABQACAAIAINcCjv4JpL+ agEAAAMEAAAb
AAAAAAAAAAAAAAAAAI0EAABNeU1vZGVsL21vZGVsL215bW9kZWwuZWNvcmVQ SwUGAAAAAAQA
BAAYAQAAQAYAAAAA
--------------020506020908090406060707--
Re: Ecore2Java: differences with the GenModel context menu? [message #479672 is a reply to message #479294] Tue, 11 August 2009 21:43 Go to previous message
Eclipse UserFriend
Originally posted by: nyoescape.gmail.com

Hi Marcelo,

> The EMF tasks are not designed to be used with the UI actions. Their
> goal is to provide the means to generate the artifacts in situations in
> which the Ui is not available. It is possible to change the code to
> provide this support. Feel free to open a feature request, remembering
> that this will be probably be a low priority at this moment.

Well, that's not quite what I meant. I just meant to say that some files
were being generated from one place and not from the other, that's all.
That is, the .project and .classpath files, mostly. I agree with the
current design.

> One very important constraint to run the EMF Ant tasks (or the EMF
> headless applications on which the tasks rely) is that they should not
> be generating artifacts in the workspace of the Eclipse that is running
> them. In other words, when running your scripts, make sure the -data
> option of your command line (or the workspace of the launcher) points to
> a different directory.

Yes, so it seems. Using anything other than a direct subdirectory of the
workspace works (for instance, (workspace)/generated/MyModel.edit works
just fine). Rather than a regular Run Configuration, I'm using an Ant
Builder, as I need it to be run from the same JRE as my Eclipse instance.

> Respecting the constraint above, I was able to generate the code that I
> believe you are looking for. One detail: the edit and editor projects
> are not added to the workspace in which your UI is running (remember
> that the Ant tasks are working on a different one).

With the "(workspace)/generated/MyModel.edit" caveat above, they are
actually added to my workspace, if I tell the Ant Builder to refresh my
entire workspace after it has run. Odd, but convenient.

> I will fix these as soon as possible. Would you mind opening one defect
> for each problem?

Well, it seems that you beat me to it :-). Thanks!

https://bugs.eclipse.org/bugs/show_bug.cgi?id=286251
https://bugs.eclipse.org/bugs/show_bug.cgi?id=286267

> I am attaching here a zip with the project that I used to generate code.
> I includes a launcher (Eclipse Ant Runner) that will run the Ant script
> that is selected in the navigator/explorer.

Works fine from here, except for the problems that you seem to have
fixed already. That was quick :-).

Thanks for the good work,
Antonio
Previous Topic:replace gen Date instead of XMLGregorianCalendar
Next Topic:URIConverter
Goto Forum:
  


Current Time: Sat Apr 20 04:29:31 GMT 2024

Powered by FUDForum. Page generated in 0.03181 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top