Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » How to access class attribute from outside of class
How to access class attribute from outside of class [message #1837724] Thu, 04 February 2021 18:34 Go to next message
Thomas Chiang is currently offline Thomas ChiangFriend
Messages: 100
Registered: March 2020
Senior Member
Hi,

I am trying to set a conditional style for my edge based upon a boolean attribute from its source node. Intuitively I assumed that the precondition would be aql: self.sourceNode.eGet(condition) but it gives the error that condition is not a variable. So then using the interpreter I selected my source node and did self.condition which gives me the same error. When I do self.name it works fine, and so does feature:condition when I set the conditional style for the node itself. How come feature:condition works but self.condition does not? And how do I access the boolean condition from my edge in order to set the conditional style for my edge?
index.php/fa/39938/0/
I am essentially trying to get the arrow leaving my classes to match the color of the source node as shown in the pic.

[Updated on: Thu, 04 February 2021 19:00]

Report message to a moderator

Re: How to access class attribute from outside of class [message #1837749 is a reply to message #1837724] Fri, 05 February 2021 08:34 Go to previous messageGo to next message
Florian Barbin is currently offline Florian BarbinFriend
Messages: 270
Registered: August 2010
Senior Member
Hi,

You can try by "casting" the type with .oclAsType(package::Type). Make sure to reference your metamodel in the Metamodels property tab on your Diagram Description.

Regards,
Florian
Re: How to access class attribute from outside of class [message #1837756 is a reply to message #1837749] Fri, 05 February 2021 14:48 Go to previous message
Thomas Chiang is currently offline Thomas ChiangFriend
Messages: 100
Registered: March 2020
Senior Member
To cast it is the command self.sourceNode.oclAsType(Metamodel::Node).condition?

Because the method oclAtType() seems to return a null for me. In my ecore metamodel I haven't set these variables:
index.php/fa/39942/0/
Because when I do the generated code gives me errors. As I am debugging is it because the generated code does not actually create the type and I need to define the type in Java?
Previous Topic:Is it possible to resize node image?
Next Topic:Note icon doesn't render when used as a bordered node
Goto Forum:
  


Current Time: Fri Apr 19 03:47:41 GMT 2024

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

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

Back to the top