Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EMF Validation, (validating an object against a parent/containing object.)
EMF Validation, [message #1251992] Thu, 20 February 2014 20:35 Go to next message
Neil Mackenzie is currently offline Neil MackenzieFriend
Messages: 131
Registered: December 2013
Senior Member

Hello,
I am tryting to write a custom validation for my EMF model.
I have a class called Table and a class Column. Tables can contain many Columns.
I would like to set a validation where a column name must be prepended by the name of the table (e.g. for a table called Book, the contained columns must have names Book.*, e.g. "Book.Author", "Book.Title")
I can add a very simple custom validation on my Column class in EMF, but I don't know how to reference the parent/containing class Table in my validation code.
Any help would be appreciated.
Thanks,
Neil
Re: EMF Validation, [message #1252329 is a reply to message #1251992] Fri, 21 February 2014 05:21 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Neil,

Comments below.

On 20/02/2014 9:35 PM, Neil Mackenzie wrote:
>
> Hello,
> I am tryting to write a custom validation for my EMF model.
> I have a class called Table and a class Column. Tables can contain
> many Columns.
> I would like to set a validation where a column name must be prepended
> by the name of the table (e.g. for a table called Book, the contained
> columns must have names Book.*, e.g. "Book.Author", "Book.Title")
> I can add a very simple custom validation on my Column class in EMF,
> but I don't know how to reference the parent/containing class Table in
> my validation code.
You should consider defining a reference "table" of type "Table" in
"Column" and making the Table.columns reference its opposite. Then you
have a getTable method you can use. Failing that column.eContainer will
typically be the Table, unless the Column is contained elsewhere.
> Any help would be appreciated.
> Thanks,
> Neil


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF Validation, [message #1252485 is a reply to message #1252329] Fri, 21 February 2014 09:06 Go to previous message
Neil Mackenzie is currently offline Neil MackenzieFriend
Messages: 131
Registered: December 2013
Senior Member
Thanks Ed,
eContainer works fine for me.
Neil
Previous Topic:open model with validating xml editor
Next Topic:[CDO] disable commit info.
Goto Forum:
  


Current Time: Sat Apr 20 02:47:45 GMT 2024

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

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

Back to the top