Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » [SOLVED] Best way to apply/assign elements to others
[SOLVED] Best way to apply/assign elements to others [message #1729346] Wed, 13 April 2016 09:30 Go to next message
Christoph Rieger is currently offline Christoph RiegerFriend
Messages: 9
Registered: April 2016
Junior Member
Hi,

I'm looking for a way to apply some sort of dynamically created role to other elements within my diagram. As basic example, a root element tracks all Roles within the model and roles can be assigned to Entities. The challenge is that the user should be able to create arbitrary new roles or reuse previously created roles.

My thoughts/attempts:
1) Dynamically change the palette to have one item per existing role and somehow add new elements at runtime. From what I know, this is not possible with Sirius.

2) Display the list of roles contained in the root element and use the drag and drop feature to apply a role to the entity element. I got it working under the condition that the target element is a container itself.
Unfortunately, for reasons of representation, the entity element is not a regular container but should display the roles as bordered entities (which in itself works fine, too). Why is it not possible to drag an item to a non-container element? And how can I get a drag to a basic node working?

Am I missing some other possibility to implement this apply/assign behavior?

Greetings,
Christoph

[Updated on: Fri, 15 April 2016 10:52]

Report message to a moderator

Re: Best way to apply/assign elements to others [message #1729482 is a reply to message #1729346] Thu, 14 April 2016 14:08 Go to previous messageGo to next message
Laurent Fasani is currently offline Laurent FasaniFriend
Messages: 182
Registered: October 2014
Senior Member
Le 13/04/2016 21:18, Christoph Rieger a écrit :
> Hi,
Hi
>
> I'm looking for a way to apply some sort of dynamically created role to
> other elements within my diagram. As basic example, a root element
> tracks all Roles within the model and roles can be assigned to Entities.
> The challenge is that the user should be able to create arbitrary new
> roles or reuse previously created roles.
>
> My thoughts/attempts:
> 1) Dynamically change the palette to have one item per existing role and
> somehow add new elements at runtime. From what I know, this is not
> possible with Sirius.
If you want to create a new role you can add a Creation Tool [1] that
creates the new role in your model and set it on the selected Entity.
To set an existing role on a entity you can, for example, add a Generic
Tool that allow to select the Entity and then add a Select Model Element
Variable under a variable of the generic tool. It'll allow you to
select, through a selection wizard, the role you want to set on the
selected Entity.

>
> 2) Display the list of roles contained in the root element and use the
> drag and drop feature to apply a role to the entity element. I got it
> working under the condition that the target element is a container itself.
> Unfortunately, for reasons of representation, the entity element is not
> a regular container but should display the roles as bordered entities
> (which in itself works fine, too). Why is it not possible to drag an
> item to a non-container element? And how can I get a drag to a basic
> node working?
Effectively, the drag'n drop tool works only if the mapping of the
source RepresentationElement (the element you want to drag, here the
node role) is the same of the mapping contained in the target
RepresentationElement (the Entity node contains only BorderedNode and
not Node)
Please, feel free to open a enhancement in Sirius Bugzilla :
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Sirius

Note that it works if you drag the role from the explorer.

>
> Am I missing some other possibility to implement this apply/assign
> behavior?
>
> Greetings,
> Christoph

[1]
http://help.eclipse.org/mars/topic/org.eclipse.sirius.doc/doc/specifier/diagrams/Diagrams.html?cp=69_2_1_4#tools


Laurent Fasani - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Best way to apply/assign elements to others [message #1729528 is a reply to message #1729482] Fri, 15 April 2016 07:22 Go to previous messageGo to next message
Laurent Fasani is currently offline Laurent FasaniFriend
Messages: 182
Registered: October 2014
Senior Member
Le 14/04/2016 16:08, Laurent Fasani a écrit :
> Le 13/04/2016 21:18, Christoph Rieger a écrit :
>> Hi,
> Hi
>>
>> I'm looking for a way to apply some sort of dynamically created role to
>> other elements within my diagram. As basic example, a root element
>> tracks all Roles within the model and roles can be assigned to Entities.
>> The challenge is that the user should be able to create arbitrary new
>> roles or reuse previously created roles.
>>
>> My thoughts/attempts:
>> 1) Dynamically change the palette to have one item per existing role and
>> somehow add new elements at runtime. From what I know, this is not
>> possible with Sirius.
> If you want to create a new role you can add a Creation Tool [1] that
> creates the new role in your model and set it on the selected Entity.
> To set an existing role on a entity you can, for example, add a Generic
> Tool that allow to select the Entity and then add a Select Model Element
> Variable under a variable of the generic tool. It'll allow you to
> select, through a selection wizard, the role you want to set on the
> selected Entity.
>
>>
>> 2) Display the list of roles contained in the root element and use the
>> drag and drop feature to apply a role to the entity element. I got it
>> working under the condition that the target element is a container
>> itself.
>> Unfortunately, for reasons of representation, the entity element is not
>> a regular container but should display the roles as bordered entities
>> (which in itself works fine, too). Why is it not possible to drag an
>> item to a non-container element? And how can I get a drag to a basic
>> node working?
> Effectively, the drag'n drop tool works only if the mapping of the
> source RepresentationElement (the element you want to drag, here the
> node role) is the same of the mapping contained in the target
> RepresentationElement (the Entity node contains only BorderedNode and
> not Node)
> Please, feel free to open a enhancement in Sirius Bugzilla :
> https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Sirius
>
> Note that it works if you drag the role from the explorer.
Actually you can drop a Node1 with mapping NM1 into another Node2 if
mapping NM2 if:
* NM2 must contains a bordered node mapping BNM with same Domainclas
than NM1
* The drop tool must have NM1 *AND* BNM in its mapping

I think this behavior has not been explicity and voluntary designed as
it is today. It could be simplified and accordingly documented.
So it could be a good thing if you could open a bugzilla with your scenario

>
>>
>> Am I missing some other possibility to implement this apply/assign
>> behavior?
>>
>> Greetings,
>> Christoph
>
> [1]
> http://help.eclipse.org/mars/topic/org.eclipse.sirius.doc/doc/specifier/diagrams/Diagrams.html?cp=69_2_1_4#tools
>


Laurent Fasani - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Best way to apply/assign elements to others [message #1729544 is a reply to message #1729528] Fri, 15 April 2016 09:45 Go to previous message
Christoph Rieger is currently offline Christoph RiegerFriend
Messages: 9
Registered: April 2016
Junior Member
Thank you Laurent for the quick replies.

The option to use a selection wizard sounds like a sensible workaround, yet I prefer a drag and drop solution which seems more natural in the context of the overall tool.

Your comment on the RepresentationElement was the key to success. I wasn't aware that the source representation matters for the ability to drop an element. Therefore, changing the drag source representation to a bordered node, too, solved my issue.
Concerning today's comment, I can confirm that this works and looks even "nicer". But this is really a weird/unexpected behaviour which I will open a bugzilla for.

Edit: It should be noted that an additional effect of having NM1 *AND* BNM in the mapping is that it also enables BNM dragging from Node2 instance to Node2 instance. It's no problem for me and I appreciate the solution, just to keep in mind if someone else stumbles about it.

Best,
Christoph

[Updated on: Fri, 15 April 2016 10:51]

Report message to a moderator

Previous Topic:[SOLVED] How to direct edit BeginLabel/CenterLabel/EndLabel of an Edge?
Next Topic:Custom LayoutProvider error
Goto Forum:
  


Current Time: Fri Apr 19 05:27:55 GMT 2024

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

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

Back to the top