Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Editor for non-unique references
Editor for non-unique references [message #425938] Fri, 12 December 2008 14:51 Go to next message
Stefan Schulze is currently offline Stefan SchulzeFriend
Messages: 70
Registered: July 2009
Member
Hi...

I have a problem regarding the generated editor. If I have an
not-containing, not-unique reference with upperBound>1 (or -1), is it right,
that it's impossible to add the same object to an reference-instance more
than one time?

For example:
I have a class "Wallet" and a class "Coin". The wallet has a not-containing
reference to multiple coins.

In the generated editor I added some coins to an containing Object and I try
to add the 50cent-Coin more than one time to my wallet. Is it right, that
this is not possible?

I'm still sticking at EMF 2.3.2 (because of some dependencies). Is this
possibly already fixed in a newer version or is there any workaround?

Bye,
Stefan
Re: Editor for non-unique references [message #425939 is a reply to message #425938] Fri, 12 December 2008 14:59 Go to previous messageGo to next message
Stefan Schulze is currently offline Stefan SchulzeFriend
Messages: 70
Registered: July 2009
Member
I forgot to append my example-metamodel:

<?xml version="1.0" encoding="ASCII"?>
<ecore:EPackage xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="money"
nsURI="someuri" nsPrefix="pre">
<eClassifiers xsi:type="ecore:EClass" name="WideWorld">
<eStructuralFeatures xsi:type="ecore:EReference" name="coins"
upperBound="-1"
eType="#//Coin" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="wallets"
upperBound="-1"
eType="#//Wallet" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Wallet">
<eStructuralFeatures xsi:type="ecore:EReference" name="coins" unique="false"
upperBound="-1"
eType="#//Coin"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Coin">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="valueInCent"
lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
</eClassifiers>
</ecore:EPackage>
Re: Editor for non-unique references [message #425944 is a reply to message #425938] Fri, 12 December 2008 21:54 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30892
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------000707050006080800000803
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Stefan,

Comments below.

Stefan Schulze wrote:
> Hi...
>
> I have a problem regarding the generated editor. If I have an
> not-containing, not-unique reference with upperBound>1 (or -1), is it right,
> that it's impossible to add the same object to an reference-instance more
> than one time?
>
If you search the newsgroups, you'll find this comes up every so often.
<https://bugs.eclipse.org/bugs/show_bug.cgi?id=89325>

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

> For example:
> I have a class "Wallet" and a class "Coin". The wallet has a not-containing
> reference to multiple coins.
>
> In the generated editor I added some coins to an containing Object and I try
> to add the 50cent-Coin more than one time to my wallet. Is it right, that
> this is not possible?
>
> I'm still sticking at EMF 2.3.2 (because of some dependencies). Is this
> possibly already fixed in a newer version or is there any workaround?
>
You can override the getter to specialize the returned list so that
isUnique returns false, but there's no guarantee the rest of the
framework will be happy.
> Bye,
> Stefan
>
>
>

--------------000707050006080800000803
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Stefan,<br>
<br>
Comments below.<br>
<br>
Stefan Schulze wrote:
<blockquote cite="mid:ghttpc$cab$1@build.eclipse.org" type="cite">
<pre wrap="">Hi...

I have a problem regarding the generated editor. If I have an
not-containing, not-unique reference with upperBound&gt;1 (or -1), is it right,
that it's impossible to add the same object to an reference-instance more
than one time?
</pre>
</blockquote>
If you search the newsgroups, you'll find this comes up every so often.<a
href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=89325"><br>
</a>
<blockquote><a
href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=89325">https://bugs.eclipse.org/bugs/show_bug.cgi?id=89325</a><br>
</blockquote>
<blockquote cite="mid:ghttpc$cab$1@build.eclipse.org" type="cite">
<pre wrap="">
For example:
I have a class "Wallet" and a class "Coin". The wallet has a not-containing
reference to multiple coins.

In the generated editor I added some coins to an containing Object and I try
to add the 50cent-Coin more than one time to my wallet. Is it right, that
this is not possible?

I'm still sticking at EMF 2.3.2 (because of some dependencies). Is this
possibly already fixed in a newer version or is there any workaround?
</pre>
</blockquote>
You can override the getter to specialize the returned list so that
isUnique returns false, but there's no guarantee the rest of the
framework will be happy.<br>
<blockquote cite="mid:ghttpc$cab$1@build.eclipse.org" type="cite">
<pre wrap="">
Bye,
Stefan


</pre>
</blockquote>
</body>
</html>

--------------000707050006080800000803--
Previous Topic:Problem with multiple ecore EMF model
Next Topic:Synchronizing the form editor with an XML source editor
Goto Forum:
  


Current Time: Thu Feb 20 13:56:06 GMT 2020

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

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

Back to the top