Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » How to set an attribute value to the value of another attribute in the EMF editor?
How to set an attribute value to the value of another attribute in the EMF editor? [message #417040] Sun, 24 February 2008 12:16 Go to next message
Reinhold Bihler is currently offline Reinhold BihlerFriend
Messages: 64
Registered: July 2009
Member
Hello,

if I set the value of the name attribute of an EEnumLiteral in the
Sample Ecore Model Editor the value of the literal attribute is
automatically set accordingly.

How is this done? Can this behavior be set somewhere in the
Gen Model or is it done by extending the editor code?

Thanks,

Reinhold

--
www.emf4net.org
Re: How to set an attribute value to the value of another attribute in the EMF editor? [message #417043 is a reply to message #417040] Sun, 24 February 2008 13:11 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------070208080009010001020401
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Reinhold,

That happens because getLiteral is hand implemented as follows such that
if there is no explicitly set literal, the name is used as the literal.

| /**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
*public *String getLiteralGen()
{
*return *literal;
}

*public *String getLiteral()
{
String result = getLiteralGen();
*return *result == *null *? getName() : result;
}|


Reinhold Bihler wrote:
> Hello,
>
> if I set the value of the name attribute of an EEnumLiteral in the
> Sample Ecore Model Editor the value of the literal attribute is
> automatically set accordingly.
>
> How is this done? Can this behavior be set somewhere in the
> Gen Model or is it done by extending the editor code?
>
> Thanks,
>
> Reinhold
>
>


--------------070208080009010001020401
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">
Reinhold,<br>
<br>
That happens because getLiteral is hand implemented as follows such
that if there is no explicitly set literal, the name is used as the
literal.<br>
<blockquote>
<title></title>
<style type="text/css">
<!--code { font-family: Courier New, Courier; font-size: 10pt; margin: 0px; }-->
</style>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<!-- ======================================================== -->
<!-- = Java Sourcecode to HTML automatically converted code = --><!-- = Java2Html Converter 5.0 [2006-02-26] by Markus Gebhard markus@jave.de = -->
<!-- = Further information: http://www.java2html.de = -->
<div class="java" align="left">
<table bgcolor="#ffffff" border="0" cellpadding="3" cellspacing="0">
<tbody>
<tr>
<!-- start source code --> <td align="left" nowrap="nowrap"
valign="top"> <code><font color="#ffffff">&nbsp;&nbsp;</font><font
color="#3f5fbf">/**</font><br>
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font
color="#7f7f9f">&lt;!--&nbsp;begin-user-doc&nbsp;--&gt; </font><br>
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font
color="#7f7f9f">&lt;!--&nbsp;end-user-doc&nbsp;--&gt; </font><br>
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;@generated</font><br>
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*/</font><br>
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#7f0055"><b>public&nbsp;</b></font><font
color="#000000">String&nbsp;getLiteralGen</font><font color="#000000">()</font><br>
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#000000">{</font><br>
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font ><font color="#7f0055"><b>return&nbsp;</b></font><font
color="#000000">literal;</font><br>
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#000000">}</font><br>
<br>
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#7f0055"><b>public&nbsp;</b></font><font
color="#000000">String&nbsp;getLiteral</font><font color="#000000">()</font><br>
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#000000">{</font><br>
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font ><font color="#000000">String&nbsp;result&nbsp;=&nbsp;getLiteralGen </font><font
color="#000000">()</font><font color="#000000">;</font><br>
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font ><font color="#7f0055"><b>return&nbsp;</b></font><font
color="#000000">result&nbsp;==&nbsp;</font><font color="#7f0055"><b>null&nbsp;</b></font><font
color="#000000">?&nbsp;getName</font><font color="#000000">()&nbsp;</font><font
color="#000000">:&nbsp;result;</font><br>
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#000000">}</font></code>
</td>
<!-- end source code --> </tr>
</tbody>
</table>
</div>
<!-- = END of automatically generated HTML code = -->
<!-- ======================================================== --></blockquote>
<br>
Reinhold Bihler wrote:
<blockquote cite="mid:fprn74$8ei$1@build.eclipse.org" type="cite">
<pre wrap="">Hello,

if I set the value of the name attribute of an EEnumLiteral in the
Sample Ecore Model Editor the value of the literal attribute is
automatically set accordingly.

How is this done? Can this behavior be set somewhere in the
Gen Model or is it done by extending the editor code?

Thanks,

Reinhold

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

--------------070208080009010001020401--


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:problem with SetCommand
Next Topic:Strange URI format
Goto Forum:
  


Current Time: Thu Apr 25 08:22:28 GMT 2024

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

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

Back to the top