[Xcore] How to generate edit code for my model? [message #804702] |
Wed, 22 February 2012 22:45 |
Marco Lehmann-Mörz Messages: 53 Registered: July 2009 |
Member |
|
|
Hi all,
I am using the latest Xcore SDK (2012-02-22) and now I am wondering how to generate the edit code for my model.
I used the library example from http://wiki.eclipse.org/Xcore.
@GenModel(
suppressEMFModelTags="true",
publicConstructors="true",
codeFormatting="true",
nonNLSMarkers="true",
richClientPlatform="true",
literalsInterface="true",
resource="XML",
editDirectory="/my-xcore.edit/src",
editPluginID="my-xcore.edit"
)
package myxcore
class Library {
String name
contains Book[0..*] books opposite library
}
@GenModel(documentation="Represents a book in a library")
class Book {
@GenModel(documentation="title of the book")
String title
container Library library opposite books
@GenModel(documentation="list with authors")
refers Writer[0..*] authors opposite books
}
class Writer {
@GenModel(documentation="name of the author")
String name
derived String lastName get {
if (name != null) {
val int idx = name.lastIndexOf(' ')
if (idx != -1) name.substring(idx + 1) else name
}
}
refers Book[0..*] books opposite authors
}
TIA,
Marco
|
|
|
Re: [Xcore] How to generate edit code for my model? [message #804894 is a reply to message #804702] |
Thu, 23 February 2012 05:40 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Marco,<br>
<br>
Unfortunately the automatic builder doesn't do that yet. <br>
<blockquote><a
href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=372062">https://bugs.eclipse.org/bugs/show_bug.cgi?id=372062</a><br>
</blockquote>
I'll work on that next and comment in the bug when it's done. Maybe
I can get something committed and into a build today. Dennis is
setting up a repo for nightly builds.<br>
<br>
In the longer term, it would be nice if documentation could come
from the comments in the source rather than from annotations (so
that long multi-line comments would be better supported)...<br>
<br>
<br>
On 22/02/2012 11:45 PM, Marco Lehmann-Mörz wrote:
<blockquote cite="mid:ji3r6i$pgf$1@news.eclipse.org" type="cite">Hi
all,
<br>
<br>
I am using the latest Xcore SDK (2012-02-22) and now I am
wondering how to generate the edit code for my model.
<br>
<br>
I used the library example from <a class="moz-txt-link-freetext" href="http://wiki.eclipse.org/Xcore">http://wiki.eclipse.org/Xcore</a>.
<br>
<br>
<br>
@GenModel(
<br>
suppressEMFModelTags="true",
<br>
publicConstructors="true",
<br>
codeFormatting="true",
<br>
nonNLSMarkers="true",
<br>
richClientPlatform="true",
<br>
literalsInterface="true",
<br>
resource="XML",
<br>
editDirectory="/my-xcore.edit/src",
<br>
editPluginID="my-xcore.edit"
<br>
)
<br>
<br>
package myxcore
<br>
<br>
class Library {
<br>
<br>
String name
<br>
contains Book[0..*] books opposite library
<br>
<br>
}
<br>
<br>
@GenModel(documentation="Represents a book in a library")
<br>
class Book {
<br>
<br>
@GenModel(documentation="title of the book")
<br>
String title
<br>
container Library library opposite books
<br>
<br>
@GenModel(documentation="list with authors")
<br>
refers Writer[0..*] authors opposite books
<br>
<br>
}
<br>
<br>
class Writer {
<br>
<br>
@GenModel(documentation="name of the author")
<br>
String name
<br>
derived String lastName get {
<br>
if (name != null) {
<br>
val int idx = name.lastIndexOf(' ')
<br>
if (idx != -1) name.substring(idx + 1) else name
<br>
}
<br>
}
<br>
refers Book[0..*] books opposite authors
<br>
}
<br>
<br>
<br>
TIA,
<br>
<br>
Marco
<br>
<br>
</blockquote>
</body>
</html>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Powered by
FUDForum. Page generated in 0.03191 seconds