Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Representation of depended parameter
Representation of depended parameter [message #869554] Thu, 03 May 2012 15:19 Go to next message
Morten MacFly is currently offline Morten MacFlyFriend
Messages: 69
Registered: July 2009
Member
Dear all,

let me explain my use case first:
I have two models:
- the first one conteins a list of items (EList) and each has a name (a
string).
- the second model references exactly one of these elements by its name
and adds aditional parameters

The sencond model must be independent from the first for distribution,
but the first (the "master" model) integrates the second one.

What I want for the second "stand-alone" model (Editor) is representing
the name as a string in a text box property, that's fine with the
generated code. But when used inside the "master model" (in another
Editor) I would like to have a different visual representstion (a
combo-cox) offering all available names only.

My question: How can I change the UI representation of such an element
that is of type string to be a combo-box and where I can control its
choices?

With regards, Morten.

Ps.: I am not exactly sure if this question belongs here, please guide
me in the right diretion, if not.
Re: Representation of depended parameter [message #869785 is a reply to message #869554] Fri, 04 May 2012 09:58 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Morten,<br>
<br>
Comments below.<br>
<br>
On 03/05/2012 5:19 PM, Morten MacFly wrote:
<blockquote cite="mid:jnu7m3$394$1@xxxxxxxxe.org" type="cite">
<pre wrap="">Dear all,

let me explain my use case first:
I have two models:
- the first one conteins a list of items (EList) and each has a name (a
string).
- the second model references exactly one of these elements by its name
and adds aditional parameters

The sencond model must be independent from the first for distribution,
but the first (the "master" model) integrates the second one.

What I want for the second "stand-alone" model (Editor) is representing
the name as a string in a text box property, that's fine with the
generated code. But when used inside the "master model" (in another
Editor) I would like to have a different visual representstion (a
combo-cox) offering all available names only.

My question: How can I change the UI representation of such an element
that is of type string to be a combo-box and where I can control its
choices?</pre>
</blockquote>
In the generated property descriptor, you'll want to specialize its
getChoiceOfValues method.&nbsp; When that returns a non-null collection
of values, the properties view will produce a drop down with exactly
those choices.&nbsp; This should give you the idea:<br>
<blockquote><a
href="http://wiki.eclipse.org/index.php/EMF-FAQ#How_can_I_control_which_instances_are_available_as_choices_when_editing_a_property_in_the_properties_view.3F"><span
class="tocnumber">2.46</span> <span class="toctext">How can I
control which instances are available as choices when editing
a property in the properties view?</span></a><br>
</blockquote>
<blockquote cite="mid:jnu7m3$394$1@xxxxxxxxe.org" type="cite">
<pre wrap="">

With regards, Morten.

Ps.: I am not exactly sure if this question belongs here, please guide
me in the right diretion, if not.
</pre>
</blockquote>
</body>
</html>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Representation of depended parameter [message #870218 is a reply to message #869785] Mon, 07 May 2012 10:10 Go to previous message
Morten MacFly is currently offline Morten MacFlyFriend
Messages: 69
Registered: July 2009
Member
Oh - should it really be that simple... I'll try that. I thought the UI
representation is more coupled...

Thanks Ed, if you don't hear again in this thread you made my day! :-)

On 04.05.2012 11:58, Ed Merks wrote:
> Morten,
>
> Comments below.
>
> On 03/05/2012 5:19 PM, Morten MacFly wrote:
>> Dear all,
>>
>> let me explain my use case first:
>> I have two models:
>> - the first one conteins a list of items (EList) and each has a name (a
>> string).
>> - the second model references exactly one of these elements by its name
>> and adds aditional parameters
>>
>> The sencond model must be independent from the first for distribution,
>> but the first (the "master" model) integrates the second one.
>>
>> What I want for the second "stand-alone" model (Editor) is representing
>> the name as a string in a text box property, that's fine with the
>> generated code. But when used inside the "master model" (in another
>> Editor) I would like to have a different visual representstion (a
>> combo-cox) offering all available names only.
>>
>> My question: How can I change the UI representation of such an element
>> that is of type string to be a combo-box and where I can control its
>> choices?
> In the generated property descriptor, you'll want to specialize its
> getChoiceOfValues method. When that returns a non-null collection of
> values, the properties view will produce a drop down with exactly those
> choices. This should give you the idea:
>
> 2.46 How can I control which instances are available as choices when
> editing a property in the properties view?
> <http://wiki.eclipse.org/index.php/EMF-FAQ#How_can_I_control_which_instances_are_available_as_choices_when_editing_a_property_in_the_properties_view.3F>
>
>>
>> With regards, Morten.
>>
>> Ps.: I am not exactly sure if this question belongs here, please guide
>> me in the right diretion, if not.
Previous Topic:Extending emf with custom properties like required property for attributes
Next Topic:Problem while importing a metamodel
Goto Forum:
  


Current Time: Thu Apr 25 08:31:43 GMT 2024

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

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

Back to the top