[EMF] Create a property Listener [message #767457] |
Sun, 18 December 2011 02:40 |
Snakebyte Missing name Messages: 130 Registered: November 2011 |
Senior Member |
|
|
Hello
i have two nodes.
Related in emfatic as follows:
@gmf.node(label="identifier", border.width="2", border.color="0,0,0", size="130,50", figure="rectangle", label.icon="false")
class Goal {
ref AwayGoal[*]#ReferencedGoal isReferencedByAwayGoals;
attr String name;
}
@gmf.node(label="identifier", border.width="1", border.color="0,0,0", size="130,50", label.icon="false", figure="rectangle")
class AwayGoal {
ref Goal[1]#isReferencedByAwayGoals ReferencedGoal;
attr String AwayGoalModuleIdentifier;
}
The Value 'AwayGoalModuleIdentifier' should now be set accordingly to the 'name' attribute of the Referenced Goal.
That means that it must be changed when the attribute 'name' of Goal is changed.
And it must be changed when the referenced Goal is changed as well.
What i now want is to add a ChangeListener to these objects.
I already tried to edit the respective generated methods.
This is setName of Goal and basicSetReferencedGoal of AwayGoal.
The first one (setName) works well...but the second one not.
So i want to implement a real Listener to these objects. Is this possible ?
Are there any examples ?
Greeting Snakebyte
[Updated on: Sun, 18 December 2011 02:41] Report message to a moderator
|
|
|
Re: [EMF] Create a property Listener [message #767544 is a reply to message #767457] |
Sun, 18 December 2011 09:17 |
Ed Merks Messages: 33142 Registered: July 2009 |
Senior Member |
|
|
Comments below.
On 18/12/2011 3:40 AM, Snakebyte wrote:
> Hello
>
> i have two nodes. Related in emfatic as follows:
>
>
>
> @gmf.node(label="identifier", border.width="2", border.color="0,0,0",
> size="130,50", figure="rectangle", label.icon="false")
> class Goal {
> ref AwayGoal[*]#ReferencedGoal isReferencedByAwayGoals;
> attr String name;
> }
>
> @gmf.node(label="identifier", border.width="1", border.color="0,0,0",
> size="130,50", label.icon="false", figure="rectangle")
> class AwayGoal {
> ref Goal[1]#isReferencedByAwayGoals ReferencedGoal;
> attr String AwayGoalModuleIdentifier;
> }
>
> The Value 'AwayGoalModuleIdentifier' should now be set accordingly to
> the 'name' attribute of the Referenced Goal.
> That means that it must be changed when the attribute 'name' of Goal
> is changed.
> And it must be changed when the referenced Goal is changed as well.
>
> What i now want is to add a ChangeListener to these objects.
>
> I already tried to edit the respective generated methods.
>
> This is setIdentifier of Goal and basicSetReferencedGoal of AwayGoal.
> The first one (setIdentifier) works well...but the second one not.
>
> So i want to implement a real Listener to these objects. Is this
> possible ?
All EObjects are Notifiers so you can add to their eAdapters list. You
might want to look at things like EContentAdapter and
ECrossReferenceAdapter as examples.
> Are there any examples ?
>
> Greeting Snakebyte
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02915 seconds