Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [EuGENia] Node label from attribute of contained class
[EuGENia] Node label from attribute of contained class [message #23406] Sun, 26 July 2009 10:59 Go to next message
Mihir is currently offline MihirFriend
Messages: 83
Registered: July 2009
Member
Hello,

Below is the snippet from the .emf file. The output of the below code
resembles to the UML Object diagram where ObjectTemplateExp is Object
and PropertyTemplateExp is the attribute in the object.

I want to fetch the value of attr "name" from VariableExp class and show
it as a label for ObjectTemplateExp node. Also, want to fetch the name
of the referred class so that the label pattern looks like "variable :
(name of referredClass)"

Same for the label of PropertyTemplateExp "(name of referredProperty) =
value"

Any help/pointers to help will be highly appreciated.

code:

@gmf.node(label="variable.name")
class ObjectTemplateExp extends ExtendedOclExp {
val VariableExp variable;

@gmf.compartment(layout="list", collapsible="false")
val PropertyTemplateExp[*] propertyTemplates;
ref EClass referredClass;
}

@gmf.node(label="name", label.icon="false", figure="rectangle")
class PropertyTemplateExp {
val ExtendedExp value;

@gmf.link(target.decoration="arrow")
ref ecore.EStructuralFeature referredProperty;
}

class VariableExp {
!unique !ordered attr String name;
}



Thanks,
Mihir
Re: [EuGENia] Node label from attribute of contained class [message #23449 is a reply to message #23406] Sun, 26 July 2009 11:08 Go to previous messageGo to next message
Mihir is currently offline MihirFriend
Messages: 83
Registered: July 2009
Member
Just to add further to my last post. I also want a simple reference link
to link a instance of ObjectTemplateExp to the other instance of
ObjectTemplateExp if the type of the referredProperty (in instance of
PropertyTemplateExp) is of type EReference.

Hope this all makes sense.

Thanks,
Mihir


Mihir wrote:
> Hello,
>
> Below is the snippet from the .emf file. The output of the below code
> resembles to the UML Object diagram where ObjectTemplateExp is Object
> and PropertyTemplateExp is the attribute in the object.
>
> I want to fetch the value of attr "name" from VariableExp class and show
> it as a label for ObjectTemplateExp node. Also, want to fetch the name
> of the referred class so that the label pattern looks like "variable :
> (name of referredClass)"
>
> Same for the label of PropertyTemplateExp "(name of referredProperty) =
> value"
>
> Any help/pointers to help will be highly appreciated.
>
> code:
>
> @gmf.node(label="variable.name")
> class ObjectTemplateExp extends ExtendedOclExp {
> val VariableExp variable;
>
> @gmf.compartment(layout="list", collapsible="false")
> val PropertyTemplateExp[*] propertyTemplates;
> ref EClass referredClass;
> }
>
> @gmf.node(label="name", label.icon="false", figure="rectangle")
> class PropertyTemplateExp {
> val ExtendedExp value;
>
> @gmf.link(target.decoration="arrow")
> ref ecore.EStructuralFeature referredProperty;
> }
>
> class VariableExp {
> !unique !ordered attr String name;
> }
>
>
>
> Thanks,
> Mihir
Re: [EuGENia] Node label from attribute of contained class [message #23534 is a reply to message #23406] Sun, 26 July 2009 11:24 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Mihir,

In this case, you'd have to add a new derived volatile and transient
attribute, and set it as the label of your ObjectTemplateExp like this:

@gmf.node(label="label")
class ObjectTemplateExp extends ExtendedOclExp {
val VariableExp variable;

derived transient volatile attr String label;

@gmf.compartment(layout="list", collapsible="false")
val PropertyTemplateExp[*] propertyTemplates;
ref EClass referredClass;
}

When you generate the EMF code, you'll need to go into the generated
ObjectTemplateExpImpl.getLabel() method, turn it to @generated NOT and
make it return variable.name (instead of throwing an unsupported
operation exception).

Cheers,
Dimitris

Mihir wrote:
> Hello,
>
> Below is the snippet from the .emf file. The output of the below code
> resembles to the UML Object diagram where ObjectTemplateExp is Object
> and PropertyTemplateExp is the attribute in the object.
>
> I want to fetch the value of attr "name" from VariableExp class and show
> it as a label for ObjectTemplateExp node. Also, want to fetch the name
> of the referred class so that the label pattern looks like "variable :
> (name of referredClass)"
>
> Same for the label of PropertyTemplateExp "(name of referredProperty) =
> value"
>
> Any help/pointers to help will be highly appreciated.
>
> code:
>
> @gmf.node(label="variable.name")
> class ObjectTemplateExp extends ExtendedOclExp {
> val VariableExp variable;
>
> @gmf.compartment(layout="list", collapsible="false")
> val PropertyTemplateExp[*] propertyTemplates;
> ref EClass referredClass;
> }
>
> @gmf.node(label="name", label.icon="false", figure="rectangle")
> class PropertyTemplateExp {
> val ExtendedExp value;
>
> @gmf.link(target.decoration="arrow")
> ref ecore.EStructuralFeature referredProperty;
> }
>
> class VariableExp {
> !unique !ordered attr String name;
> }
>
>
>
> Thanks,
> Mihir
Re: [EuGENia] Node label from attribute of contained class [message #23576 is a reply to message #23449] Sun, 26 July 2009 11:27 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Mihir,

I'm not sure I understand this :( Do you need links to be automatically
created between unlinked objects when a certain condition is satisfied?

Cheers,
Dimitris

Mihir wrote:
> Just to add further to my last post. I also want a simple reference link
> to link a instance of ObjectTemplateExp to the other instance of
> ObjectTemplateExp if the type of the referredProperty (in instance of
> PropertyTemplateExp) is of type EReference.
>
> Hope this all makes sense.
>
> Thanks,
> Mihir
>
>
> Mihir wrote:
>> Hello,
>>
>> Below is the snippet from the .emf file. The output of the below code
>> resembles to the UML Object diagram where ObjectTemplateExp is Object
>> and PropertyTemplateExp is the attribute in the object.
>>
>> I want to fetch the value of attr "name" from VariableExp class and
>> show it as a label for ObjectTemplateExp node. Also, want to fetch the
>> name of the referred class so that the label pattern looks like
>> "variable : (name of referredClass)"
>>
>> Same for the label of PropertyTemplateExp "(name of referredProperty)
>> = value"
>>
>> Any help/pointers to help will be highly appreciated.
>>
>> code:
>>
>> @gmf.node(label="variable.name")
>> class ObjectTemplateExp extends ExtendedOclExp {
>> val VariableExp variable;
>>
>> @gmf.compartment(layout="list", collapsible="false")
>> val PropertyTemplateExp[*] propertyTemplates;
>> ref EClass referredClass;
>> }
>>
>> @gmf.node(label="name", label.icon="false", figure="rectangle")
>> class PropertyTemplateExp {
>> val ExtendedExp value;
>>
>> @gmf.link(target.decoration="arrow")
>> ref ecore.EStructuralFeature referredProperty;
>> }
>>
>> class VariableExp {
>> !unique !ordered attr String name;
>> }
>>
>>
>>
>> Thanks,
>> Mihir
Re: [EuGENia] Node label from attribute of contained class [message #23662 is a reply to message #23534] Sun, 26 July 2009 11:41 Go to previous messageGo to next message
Mihir is currently offline MihirFriend
Messages: 83
Registered: July 2009
Member
Hello Dimitris,

Many thanks for your quick reply. I'll try and implement this and get
back to you soon. I don't if it is a feasible question but can we make
it work without adding that extra derived transient volatile attribute??
Because, the thing is I don't want to make any changes in the metamodel.
I'll still try your this suggested technique.

Thanks,
Mihir


Dimitris Kolovos wrote:
> Hi Mihir,
>
> In this case, you'd have to add a new derived volatile and transient
> attribute, and set it as the label of your ObjectTemplateExp like this:
>
> @gmf.node(label="label")
> class ObjectTemplateExp extends ExtendedOclExp {
> val VariableExp variable;
>
> derived transient volatile attr String label;
>
> @gmf.compartment(layout="list", collapsible="false")
> val PropertyTemplateExp[*] propertyTemplates;
> ref EClass referredClass;
> }
>
> When you generate the EMF code, you'll need to go into the generated
> ObjectTemplateExpImpl.getLabel() method, turn it to @generated NOT and
> make it return variable.name (instead of throwing an unsupported
> operation exception).
>
> Cheers,
> Dimitris
>
> Mihir wrote:
>> Hello,
>>
>> Below is the snippet from the .emf file. The output of the below code
>> resembles to the UML Object diagram where ObjectTemplateExp is Object
>> and PropertyTemplateExp is the attribute in the object.
>>
>> I want to fetch the value of attr "name" from VariableExp class and
>> show it as a label for ObjectTemplateExp node. Also, want to fetch the
>> name of the referred class so that the label pattern looks like
>> "variable : (name of referredClass)"
>>
>> Same for the label of PropertyTemplateExp "(name of referredProperty)
>> = value"
>>
>> Any help/pointers to help will be highly appreciated.
>>
>> code:
>>
>> @gmf.node(label="variable.name")
>> class ObjectTemplateExp extends ExtendedOclExp {
>> val VariableExp variable;
>>
>> @gmf.compartment(layout="list", collapsible="false")
>> val PropertyTemplateExp[*] propertyTemplates;
>> ref EClass referredClass;
>> }
>>
>> @gmf.node(label="name", label.icon="false", figure="rectangle")
>> class PropertyTemplateExp {
>> val ExtendedExp value;
>>
>> @gmf.link(target.decoration="arrow")
>> ref ecore.EStructuralFeature referredProperty;
>> }
>>
>> class VariableExp {
>> !unique !ordered attr String name;
>> }
>>
>>
>>
>> Thanks,
>> Mihir
Re: [EuGENia] Node label from attribute of contained class [message #23704 is a reply to message #23576] Sun, 26 July 2009 11:45 Go to previous messageGo to next message
Mihir is currently offline MihirFriend
Messages: 83
Registered: July 2009
Member
Hi Dimitris,

Thanks for you quick reply. I was meant to add the link manually from
tools palette. But, it would be great to achieve your idea as well.. ;)
Awaiting for your input. :)

Thanks,
Mihir


Dimitris Kolovos wrote:
> Hi Mihir,
>
> I'm not sure I understand this :( Do you need links to be automatically
> created between unlinked objects when a certain condition is satisfied?
>
> Cheers,
> Dimitris
>
> Mihir wrote:
>> Just to add further to my last post. I also want a simple reference
>> link to link a instance of ObjectTemplateExp to the other
>> instance of ObjectTemplateExp if the type of the referredProperty (in
>> instance of PropertyTemplateExp) is of type EReference.
>>
>> Hope this all makes sense.
>>
>> Thanks,
>> Mihir
>>
>>
>> Mihir wrote:
>>> Hello,
>>>
>>> Below is the snippet from the .emf file. The output of the below code
>>> resembles to the UML Object diagram where ObjectTemplateExp is Object
>>> and PropertyTemplateExp is the attribute in the object.
>>>
>>> I want to fetch the value of attr "name" from VariableExp class and
>>> show it as a label for ObjectTemplateExp node. Also, want to fetch
>>> the name of the referred class so that the label pattern looks like
>>> "variable : (name of referredClass)"
>>>
>>> Same for the label of PropertyTemplateExp "(name of referredProperty)
>>> = value"
>>>
>>> Any help/pointers to help will be highly appreciated.
>>>
>>> code:
>>>
>>> @gmf.node(label="variable.name")
>>> class ObjectTemplateExp extends ExtendedOclExp {
>>> val VariableExp variable;
>>>
>>> @gmf.compartment(layout="list", collapsible="false")
>>> val PropertyTemplateExp[*] propertyTemplates;
>>> ref EClass referredClass;
>>> }
>>>
>>> @gmf.node(label="name", label.icon="false", figure="rectangle")
>>> class PropertyTemplateExp {
>>> val ExtendedExp value;
>>>
>>> @gmf.link(target.decoration="arrow")
>>> ref ecore.EStructuralFeature referredProperty;
>>> }
>>>
>>> class VariableExp {
>>> !unique !ordered attr String name;
>>> }
>>>
>>>
>>>
>>> Thanks,
>>> Mihir
Re: [EuGENia] Node label from attribute of contained class [message #23785 is a reply to message #23704] Sun, 26 July 2009 11:52 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Mihir,

Mihir wrote:
> Hi Dimitris,
>
> Thanks for you quick reply. I was meant to add the link manually from
> tools palette.

So you actually want to prevent users from creating a link between the
two objects if the condition is not satisfied. I know that this is
possible using OCL but to be honest, I haven't ever played with this
feature. I'll look into this in the next few days and get back to you.
If by any chance you manage to make any progress with this before I do,
it'd be great if you could report back with the solution you've found.

> But, it would be great to achieve your idea as well.. ;)

It should be possible to do this in a batch mode using EWL. See

http://www.eclipse.org/gmt/epsilon/doc/ewl

and the example in

http://www.eclipse.org/gmt/epsilon/cinema/#GMFWizards2

for more details.

> Awaiting for your input. :)
>
> Thanks,
> Mihir
>

Cheers,
Dimitris
>
> Dimitris Kolovos wrote:
>> Hi Mihir,
>>
>> I'm not sure I understand this :( Do you need links to be
>> automatically created between unlinked objects when a certain
>> condition is satisfied?
>>
>> Cheers,
>> Dimitris
>>
>> Mihir wrote:
>>> Just to add further to my last post. I also want a simple reference
>>> link to link a instance of ObjectTemplateExp to the other
>>> instance of ObjectTemplateExp if the type of the referredProperty (in
>>> instance of PropertyTemplateExp) is of type EReference.
>>>
>>> Hope this all makes sense.
>>>
>>> Thanks,
>>> Mihir
>>>
>>>
>>> Mihir wrote:
>>>> Hello,
>>>>
>>>> Below is the snippet from the .emf file. The output of the below
>>>> code resembles to the UML Object diagram where ObjectTemplateExp is
>>>> Object and PropertyTemplateExp is the attribute in the object.
>>>>
>>>> I want to fetch the value of attr "name" from VariableExp class and
>>>> show it as a label for ObjectTemplateExp node. Also, want to fetch
>>>> the name of the referred class so that the label pattern looks like
>>>> "variable : (name of referredClass)"
>>>>
>>>> Same for the label of PropertyTemplateExp "(name of
>>>> referredProperty) = value"
>>>>
>>>> Any help/pointers to help will be highly appreciated.
>>>>
>>>> code:
>>>>
>>>> @gmf.node(label="variable.name")
>>>> class ObjectTemplateExp extends ExtendedOclExp {
>>>> val VariableExp variable;
>>>>
>>>> @gmf.compartment(layout="list", collapsible="false")
>>>> val PropertyTemplateExp[*] propertyTemplates;
>>>> ref EClass referredClass;
>>>> }
>>>>
>>>> @gmf.node(label="name", label.icon="false", figure="rectangle")
>>>> class PropertyTemplateExp {
>>>> val ExtendedExp value;
>>>>
>>>> @gmf.link(target.decoration="arrow")
>>>> ref ecore.EStructuralFeature referredProperty;
>>>> }
>>>>
>>>> class VariableExp {
>>>> !unique !ordered attr String name;
>>>> }
>>>>
>>>>
>>>>
>>>> Thanks,
>>>> Mihir
Re: [EuGENia] Node label from attribute of contained class [message #23828 is a reply to message #23662] Sun, 26 July 2009 11:54 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Mihir,

I don't know if it is possible to do this without adding that extra
attribute. Another question for the GMF newsgroup it seems ;)

Cheers,
Dimitris

Mihir wrote:
> Hello Dimitris,
>
> Many thanks for your quick reply. I'll try and implement this and get
> back to you soon. I don't if it is a feasible question but can we make
> it work without adding that extra derived transient volatile attribute??
> Because, the thing is I don't want to make any changes in the metamodel.
> I'll still try your this suggested technique.
>
> Thanks,
> Mihir
>
>
> Dimitris Kolovos wrote:
>> Hi Mihir,
>>
>> In this case, you'd have to add a new derived volatile and transient
>> attribute, and set it as the label of your ObjectTemplateExp like this:
>>
>> @gmf.node(label="label")
>> class ObjectTemplateExp extends ExtendedOclExp {
>> val VariableExp variable;
>>
>> derived transient volatile attr String label;
>>
>> @gmf.compartment(layout="list", collapsible="false")
>> val PropertyTemplateExp[*] propertyTemplates;
>> ref EClass referredClass;
>> }
>>
>> When you generate the EMF code, you'll need to go into the generated
>> ObjectTemplateExpImpl.getLabel() method, turn it to @generated NOT and
>> make it return variable.name (instead of throwing an unsupported
>> operation exception).
>>
>> Cheers,
>> Dimitris
>>
>> Mihir wrote:
>>> Hello,
>>>
>>> Below is the snippet from the .emf file. The output of the below code
>>> resembles to the UML Object diagram where ObjectTemplateExp is Object
>>> and PropertyTemplateExp is the attribute in the object.
>>>
>>> I want to fetch the value of attr "name" from VariableExp class and
>>> show it as a label for ObjectTemplateExp node. Also, want to fetch
>>> the name of the referred class so that the label pattern looks like
>>> "variable : (name of referredClass)"
>>>
>>> Same for the label of PropertyTemplateExp "(name of referredProperty)
>>> = value"
>>>
>>> Any help/pointers to help will be highly appreciated.
>>>
>>> code:
>>>
>>> @gmf.node(label="variable.name")
>>> class ObjectTemplateExp extends ExtendedOclExp {
>>> val VariableExp variable;
>>>
>>> @gmf.compartment(layout="list", collapsible="false")
>>> val PropertyTemplateExp[*] propertyTemplates;
>>> ref EClass referredClass;
>>> }
>>>
>>> @gmf.node(label="name", label.icon="false", figure="rectangle")
>>> class PropertyTemplateExp {
>>> val ExtendedExp value;
>>>
>>> @gmf.link(target.decoration="arrow")
>>> ref ecore.EStructuralFeature referredProperty;
>>> }
>>>
>>> class VariableExp {
>>> !unique !ordered attr String name;
>>> }
>>>
>>>
>>>
>>> Thanks,
>>> Mihir
Re: [EuGENia] Node label from attribute of contained class [message #23868 is a reply to message #23785] Sun, 26 July 2009 12:11 Go to previous messageGo to next message
Mihir is currently offline MihirFriend
Messages: 83
Registered: July 2009
Member
OK Dimitris,

I'm looking at the links sent by you. And I'll update you if I found
anything.

Meanwhile, I've this 1 stupid question. It is related to GMF but, still
asking if you know any solution for this. The description of question is
once I've generated all the codes for the editor and tested it. Then, I
update the definition in .emf file and generate all the required codes.
Now if I've removed anything from the .emf ( for example I remove a link
annotation) and then generate the code I get error in the generated
code. If I delete all the code and regenerate it, it works fine. Just
wondering if you have any solution for this.

Cheers,
Mihir



Dimitris Kolovos wrote:
> Hi Mihir,
>
> Mihir wrote:
>> Hi Dimitris,
>>
>> Thanks for you quick reply. I was meant to add the link manually from
>> tools palette.
>
> So you actually want to prevent users from creating a link between the
> two objects if the condition is not satisfied. I know that this is
> possible using OCL but to be honest, I haven't ever played with this
> feature. I'll look into this in the next few days and get back to you.
> If by any chance you manage to make any progress with this before I do,
> it'd be great if you could report back with the solution you've found.
>
>> But, it would be great to achieve your idea as well.. ;)
>
> It should be possible to do this in a batch mode using EWL. See
>
> http://www.eclipse.org/gmt/epsilon/doc/ewl
>
> and the example in
>
> http://www.eclipse.org/gmt/epsilon/cinema/#GMFWizards2
>
> for more details.
>
>> Awaiting for your input. :)
>>
>> Thanks,
>> Mihir
>>
>
> Cheers,
> Dimitris
>>
>> Dimitris Kolovos wrote:
>>> Hi Mihir,
>>>
>>> I'm not sure I understand this :( Do you need links to be
>>> automatically created between unlinked objects when a certain
>>> condition is satisfied?
>>>
>>> Cheers,
>>> Dimitris
>>>
>>> Mihir wrote:
>>>> Just to add further to my last post. I also want a simple reference
>>>> link to link a instance of ObjectTemplateExp to the other
>>>> instance of ObjectTemplateExp if the type of the referredProperty
>>>> (in instance of PropertyTemplateExp) is of type EReference.
>>>>
>>>> Hope this all makes sense.
>>>>
>>>> Thanks,
>>>> Mihir
>>>>
>>>>
>>>> Mihir wrote:
>>>>> Hello,
>>>>>
>>>>> Below is the snippet from the .emf file. The output of the below
>>>>> code resembles to the UML Object diagram where ObjectTemplateExp is
>>>>> Object and PropertyTemplateExp is the attribute in the object.
>>>>>
>>>>> I want to fetch the value of attr "name" from VariableExp class and
>>>>> show it as a label for ObjectTemplateExp node. Also, want to fetch
>>>>> the name of the referred class so that the label pattern looks like
>>>>> "variable : (name of referredClass)"
>>>>>
>>>>> Same for the label of PropertyTemplateExp "(name of
>>>>> referredProperty) = value"
>>>>>
>>>>> Any help/pointers to help will be highly appreciated.
>>>>>
>>>>> code:
>>>>>
>>>>> @gmf.node(label="variable.name")
>>>>> class ObjectTemplateExp extends ExtendedOclExp {
>>>>> val VariableExp variable;
>>>>>
>>>>> @gmf.compartment(layout="list", collapsible="false")
>>>>> val PropertyTemplateExp[*] propertyTemplates;
>>>>> ref EClass referredClass;
>>>>> }
>>>>>
>>>>> @gmf.node(label="name", label.icon="false", figure="rectangle")
>>>>> class PropertyTemplateExp {
>>>>> val ExtendedExp value;
>>>>>
>>>>> @gmf.link(target.decoration="arrow")
>>>>> ref ecore.EStructuralFeature referredProperty;
>>>>> }
>>>>>
>>>>> class VariableExp {
>>>>> !unique !ordered attr String name;
>>>>> }
>>>>>
>>>>>
>>>>>
>>>>> Thanks,
>>>>> Mihir
Re: [EuGENia] Node label from attribute of contained class [message #23909 is a reply to message #23868] Sun, 26 July 2009 12:16 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Mihir,

This is reasonable as the generator doesn't attempt to delete files that
it generated in a previous run but are not necessary any more.

Cheers,
Dimitris

Mihir wrote:
> OK Dimitris,
>
> I'm looking at the links sent by you. And I'll update you if I found
> anything.
>
> Meanwhile, I've this 1 stupid question. It is related to GMF but, still
> asking if you know any solution for this. The description of question is
> once I've generated all the codes for the editor and tested it. Then, I
> update the definition in .emf file and generate all the required codes.
> Now if I've removed anything from the .emf ( for example I remove a link
> annotation) and then generate the code I get error in the generated
> code. If I delete all the code and regenerate it, it works fine. Just
> wondering if you have any solution for this.
>
> Cheers,
> Mihir
>
>
>
> Dimitris Kolovos wrote:
>> Hi Mihir,
>>
>> Mihir wrote:
>>> Hi Dimitris,
>>>
>>> Thanks for you quick reply. I was meant to add the link manually from
>>> tools palette.
>>
>> So you actually want to prevent users from creating a link between the
>> two objects if the condition is not satisfied. I know that this is
>> possible using OCL but to be honest, I haven't ever played with this
>> feature. I'll look into this in the next few days and get back to you.
>> If by any chance you manage to make any progress with this before I
>> do, it'd be great if you could report back with the solution you've
>> found.
>>
>>> But, it would be great to achieve your idea as well.. ;)
>>
>> It should be possible to do this in a batch mode using EWL. See
>>
>> http://www.eclipse.org/gmt/epsilon/doc/ewl
>>
>> and the example in
>>
>> http://www.eclipse.org/gmt/epsilon/cinema/#GMFWizards2
>>
>> for more details.
>>
>>> Awaiting for your input. :)
>>>
>>> Thanks,
>>> Mihir
>>>
>>
>> Cheers,
>> Dimitris
>>>
>>> Dimitris Kolovos wrote:
>>>> Hi Mihir,
>>>>
>>>> I'm not sure I understand this :( Do you need links to be
>>>> automatically created between unlinked objects when a certain
>>>> condition is satisfied?
>>>>
>>>> Cheers,
>>>> Dimitris
>>>>
>>>> Mihir wrote:
>>>>> Just to add further to my last post. I also want a simple reference
>>>>> link to link a instance of ObjectTemplateExp to the other
>>>>> instance of ObjectTemplateExp if the type of the referredProperty
>>>>> (in instance of PropertyTemplateExp) is of type EReference.
>>>>>
>>>>> Hope this all makes sense.
>>>>>
>>>>> Thanks,
>>>>> Mihir
>>>>>
>>>>>
>>>>> Mihir wrote:
>>>>>> Hello,
>>>>>>
>>>>>> Below is the snippet from the .emf file. The output of the below
>>>>>> code resembles to the UML Object diagram where ObjectTemplateExp
>>>>>> is Object and PropertyTemplateExp is the attribute in the object.
>>>>>>
>>>>>> I want to fetch the value of attr "name" from VariableExp class
>>>>>> and show it as a label for ObjectTemplateExp node. Also, want to
>>>>>> fetch the name of the referred class so that the label pattern
>>>>>> looks like "variable : (name of referredClass)"
>>>>>>
>>>>>> Same for the label of PropertyTemplateExp "(name of
>>>>>> referredProperty) = value"
>>>>>>
>>>>>> Any help/pointers to help will be highly appreciated.
>>>>>>
>>>>>> code:
>>>>>>
>>>>>> @gmf.node(label="variable.name")
>>>>>> class ObjectTemplateExp extends ExtendedOclExp {
>>>>>> val VariableExp variable;
>>>>>>
>>>>>> @gmf.compartment(layout="list", collapsible="false")
>>>>>> val PropertyTemplateExp[*] propertyTemplates;
>>>>>> ref EClass referredClass;
>>>>>> }
>>>>>>
>>>>>> @gmf.node(label="name", label.icon="false", figure="rectangle")
>>>>>> class PropertyTemplateExp {
>>>>>> val ExtendedExp value;
>>>>>>
>>>>>> @gmf.link(target.decoration="arrow")
>>>>>> ref ecore.EStructuralFeature referredProperty;
>>>>>> }
>>>>>>
>>>>>> class VariableExp {
>>>>>> !unique !ordered attr String name;
>>>>>> }
>>>>>>
>>>>>>
>>>>>>
>>>>>> Thanks,
>>>>>> Mihir
Re: [EuGENia] Node label from attribute of contained class [message #23949 is a reply to message #23909] Sun, 26 July 2009 12:23 Go to previous messageGo to next message
Mihir is currently offline MihirFriend
Messages: 83
Registered: July 2009
Member
So I'll have to delete the generated code before generating new code.
I'll have to keep track if I've made any changes in the generated code
and make those changes again. Arghhh!!

Anyways thanks a million for your quick response. I'm newbie in this
group and even to the GMF stuffs.

Cheers,
Mihir


Dimitris Kolovos wrote:
> Hi Mihir,
>
> This is reasonable as the generator doesn't attempt to delete files that
> it generated in a previous run but are not necessary any more.
>
> Cheers,
> Dimitris
>
> Mihir wrote:
>> OK Dimitris,
>>
>> I'm looking at the links sent by you. And I'll update you if I found
>> anything.
>>
>> Meanwhile, I've this 1 stupid question. It is related to GMF but,
>> still asking if you know any solution for this. The description of
>> question is once I've generated all the codes for the editor and
>> tested it. Then, I update the definition in .emf file and generate all
>> the required codes. Now if I've removed anything from the .emf ( for
>> example I remove a link annotation) and then generate the code I get
>> error in the generated code. If I delete all the code and regenerate
>> it, it works fine. Just wondering if you have any solution for this.
>>
>> Cheers,
>> Mihir
>>
>>
>>
>> Dimitris Kolovos wrote:
>>> Hi Mihir,
>>>
>>> Mihir wrote:
>>>> Hi Dimitris,
>>>>
>>>> Thanks for you quick reply. I was meant to add the link manually
>>>> from tools palette.
>>>
>>> So you actually want to prevent users from creating a link between
>>> the two objects if the condition is not satisfied. I know that this
>>> is possible using OCL but to be honest, I haven't ever played with
>>> this feature. I'll look into this in the next few days and get back
>>> to you. If by any chance you manage to make any progress with this
>>> before I do, it'd be great if you could report back with the solution
>>> you've found.
>>>
>>>> But, it would be great to achieve your idea as well.. ;)
>>>
>>> It should be possible to do this in a batch mode using EWL. See
>>>
>>> http://www.eclipse.org/gmt/epsilon/doc/ewl
>>>
>>> and the example in
>>>
>>> http://www.eclipse.org/gmt/epsilon/cinema/#GMFWizards2
>>>
>>> for more details.
>>>
>>>> Awaiting for your input. :)
>>>>
>>>> Thanks,
>>>> Mihir
>>>>
>>>
>>> Cheers,
>>> Dimitris
>>>>
>>>> Dimitris Kolovos wrote:
>>>>> Hi Mihir,
>>>>>
>>>>> I'm not sure I understand this :( Do you need links to be
>>>>> automatically created between unlinked objects when a certain
>>>>> condition is satisfied?
>>>>>
>>>>> Cheers,
>>>>> Dimitris
>>>>>
>>>>> Mihir wrote:
>>>>>> Just to add further to my last post. I also want a simple
>>>>>> reference link to link a instance of ObjectTemplateExp to the
>>>>>> other instance of ObjectTemplateExp if the type of the
>>>>>> referredProperty (in instance of PropertyTemplateExp) is of type
>>>>>> EReference.
>>>>>>
>>>>>> Hope this all makes sense.
>>>>>>
>>>>>> Thanks,
>>>>>> Mihir
>>>>>>
>>>>>>
>>>>>> Mihir wrote:
>>>>>>> Hello,
>>>>>>>
>>>>>>> Below is the snippet from the .emf file. The output of the below
>>>>>>> code resembles to the UML Object diagram where ObjectTemplateExp
>>>>>>> is Object and PropertyTemplateExp is the attribute in the object.
>>>>>>>
>>>>>>> I want to fetch the value of attr "name" from VariableExp class
>>>>>>> and show it as a label for ObjectTemplateExp node. Also, want to
>>>>>>> fetch the name of the referred class so that the label pattern
>>>>>>> looks like "variable : (name of referredClass)"
>>>>>>>
>>>>>>> Same for the label of PropertyTemplateExp "(name of
>>>>>>> referredProperty) = value"
>>>>>>>
>>>>>>> Any help/pointers to help will be highly appreciated.
>>>>>>>
>>>>>>> code:
>>>>>>>
>>>>>>> @gmf.node(label="variable.name")
>>>>>>> class ObjectTemplateExp extends ExtendedOclExp {
>>>>>>> val VariableExp variable;
>>>>>>>
>>>>>>> @gmf.compartment(layout="list", collapsible="false")
>>>>>>> val PropertyTemplateExp[*] propertyTemplates;
>>>>>>> ref EClass referredClass;
>>>>>>> }
>>>>>>>
>>>>>>> @gmf.node(label="name", label.icon="false", figure="rectangle")
>>>>>>> class PropertyTemplateExp {
>>>>>>> val ExtendedExp value;
>>>>>>>
>>>>>>> @gmf.link(target.decoration="arrow")
>>>>>>> ref ecore.EStructuralFeature referredProperty;
>>>>>>> }
>>>>>>>
>>>>>>> class VariableExp {
>>>>>>> !unique !ordered attr String name;
>>>>>>> }
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Mihir
Re: [EuGENia] Node label from attribute of contained class [message #23987 is a reply to message #23534] Sun, 26 July 2009 19:22 Go to previous messageGo to next message
Mihir is currently offline MihirFriend
Messages: 83
Registered: July 2009
Member
Hello Dimitris,

Sorry for delayed reply. I'd gone out for a while.

I've implemented a derived attribute and generated all the code as told
by you. But, what I saw is that it is same as adding a new simple
attribute to the class because the generated code seems like the same as
that generated for simple attribute. Below is the code that is
generated. I can't find any code throwing unsupported operation exception.


public String getLabel() {
return
(String)eGet(Moment2transformationPackage.Literals.OBJECT_TE MPLATE_EXP__LABEL,
true);
}

public void setLabel(String newLabel) {
eSet(Moment2transformationPackage.Literals.OBJECT_TEMPLATE_E XP__LABEL,
newLabel);
}


Cheers,
Mihir



Dimitris Kolovos wrote:
> Hi Mihir,
>
> In this case, you'd have to add a new derived volatile and transient
> attribute, and set it as the label of your ObjectTemplateExp like this:
>
> @gmf.node(label="label")
> class ObjectTemplateExp extends ExtendedOclExp {
> val VariableExp variable;
>
> derived transient volatile attr String label;
>
> @gmf.compartment(layout="list", collapsible="false")
> val PropertyTemplateExp[*] propertyTemplates;
> ref EClass referredClass;
> }
>
> When you generate the EMF code, you'll need to go into the generated
> ObjectTemplateExpImpl.getLabel() method, turn it to @generated NOT and
> make it return variable.name (instead of throwing an unsupported
> operation exception).
>
> Cheers,
> Dimitris
>
> Mihir wrote:
>> Hello,
>>
>> Below is the snippet from the .emf file. The output of the below code
>> resembles to the UML Object diagram where ObjectTemplateExp is Object
>> and PropertyTemplateExp is the attribute in the object.
>>
>> I want to fetch the value of attr "name" from VariableExp class and
>> show it as a label for ObjectTemplateExp node. Also, want to fetch the
>> name of the referred class so that the label pattern looks like
>> "variable : (name of referredClass)"
>>
>> Same for the label of PropertyTemplateExp "(name of referredProperty)
>> = value"
>>
>> Any help/pointers to help will be highly appreciated.
>>
>> code:
>>
>> @gmf.node(label="variable.name")
>> class ObjectTemplateExp extends ExtendedOclExp {
>> val VariableExp variable;
>>
>> @gmf.compartment(layout="list", collapsible="false")
>> val PropertyTemplateExp[*] propertyTemplates;
>> ref EClass referredClass;
>> }
>>
>> @gmf.node(label="name", label.icon="false", figure="rectangle")
>> class PropertyTemplateExp {
>> val ExtendedExp value;
>>
>> @gmf.link(target.decoration="arrow")
>> ref ecore.EStructuralFeature referredProperty;
>> }
>>
>> class VariableExp {
>> !unique !ordered attr String name;
>> }
>>
>>
>>
>> Thanks,
>> Mihir
Re: [EuGENia] Node label from attribute of contained class [message #24024 is a reply to message #23987] Mon, 27 July 2009 12:03 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Mihir,

Could you please check again that you have all 3 modifiers in your label
attribute and that you have regenerated the .ecore from the .emf and
reloaded the .genmodel? (if necessary, please delete the .genmodel and
regenerate it).

Cheers,
Dimitris

Mihir wrote:
> Hello Dimitris,
>
> Sorry for delayed reply. I'd gone out for a while.
>
> I've implemented a derived attribute and generated all the code as told
> by you. But, what I saw is that it is same as adding a new simple
> attribute to the class because the generated code seems like the same as
> that generated for simple attribute. Below is the code that is
> generated. I can't find any code throwing unsupported operation exception.
>
>
> public String getLabel() {
> return
> (String)eGet(Moment2transformationPackage.Literals.OBJECT_TE MPLATE_EXP__LABEL,
> true);
> }
>
> public void setLabel(String newLabel) {
> eSet(Moment2transformationPackage.Literals.OBJECT_TEMPLATE_E XP__LABEL,
> newLabel);
> }
>
>
> Cheers,
> Mihir
>
>
>
> Dimitris Kolovos wrote:
>> Hi Mihir,
>>
>> In this case, you'd have to add a new derived volatile and transient
>> attribute, and set it as the label of your ObjectTemplateExp like this:
>>
>> @gmf.node(label="label")
>> class ObjectTemplateExp extends ExtendedOclExp {
>> val VariableExp variable;
>>
>> derived transient volatile attr String label;
>>
>> @gmf.compartment(layout="list", collapsible="false")
>> val PropertyTemplateExp[*] propertyTemplates;
>> ref EClass referredClass;
>> }
>>
>> When you generate the EMF code, you'll need to go into the generated
>> ObjectTemplateExpImpl.getLabel() method, turn it to @generated NOT and
>> make it return variable.name (instead of throwing an unsupported
>> operation exception).
>>
>> Cheers,
>> Dimitris
>>
>> Mihir wrote:
>>> Hello,
>>>
>>> Below is the snippet from the .emf file. The output of the below code
>>> resembles to the UML Object diagram where ObjectTemplateExp is Object
>>> and PropertyTemplateExp is the attribute in the object.
>>>
>>> I want to fetch the value of attr "name" from VariableExp class and
>>> show it as a label for ObjectTemplateExp node. Also, want to fetch
>>> the name of the referred class so that the label pattern looks like
>>> "variable : (name of referredClass)"
>>>
>>> Same for the label of PropertyTemplateExp "(name of referredProperty)
>>> = value"
>>>
>>> Any help/pointers to help will be highly appreciated.
>>>
>>> code:
>>>
>>> @gmf.node(label="variable.name")
>>> class ObjectTemplateExp extends ExtendedOclExp {
>>> val VariableExp variable;
>>>
>>> @gmf.compartment(layout="list", collapsible="false")
>>> val PropertyTemplateExp[*] propertyTemplates;
>>> ref EClass referredClass;
>>> }
>>>
>>> @gmf.node(label="name", label.icon="false", figure="rectangle")
>>> class PropertyTemplateExp {
>>> val ExtendedExp value;
>>>
>>> @gmf.link(target.decoration="arrow")
>>> ref ecore.EStructuralFeature referredProperty;
>>> }
>>>
>>> class VariableExp {
>>> !unique !ordered attr String name;
>>> }
>>>
>>>
>>>
>>> Thanks,
>>> Mihir
Re: [EuGENia] Node label from attribute of contained class [message #80936 is a reply to message #24024] Mon, 27 July 2009 18:29 Go to previous messageGo to next message
Mihir is currently offline MihirFriend
Messages: 83
Registered: July 2009
Member
Hi Dimitris,

I did tried this couple of times. Deleted all the generated code and all
those model files. Regenerated everything.. still it generates same code. :S

Sorry for delayed reply.

Cheers,
Mihir




Dimitris Kolovos wrote:
> Hi Mihir,
>
> Could you please check again that you have all 3 modifiers in your label
> attribute and that you have regenerated the .ecore from the .emf and
> reloaded the .genmodel? (if necessary, please delete the .genmodel and
> regenerate it).
>
> Cheers,
> Dimitris
>
> Mihir wrote:
>> Hello Dimitris,
>>
>> Sorry for delayed reply. I'd gone out for a while.
>>
>> I've implemented a derived attribute and generated all the code as
>> told by you. But, what I saw is that it is same as adding a new simple
>> attribute to the class because the generated code seems like the same
>> as that generated for simple attribute. Below is the code that is
>> generated. I can't find any code throwing unsupported operation
>> exception.
>>
>>
>> public String getLabel() {
>> return
>> (String)eGet(Moment2transformationPackage.Literals.OBJECT_TE MPLATE_EXP__LABEL,
>> true);
>> }
>>
>> public void setLabel(String newLabel) {
>>
>> eSet(Moment2transformationPackage.Literals.OBJECT_TEMPLATE_E XP__LABEL,
>> newLabel);
>> }
>>
>>
>> Cheers,
>> Mihir
>>
>>
>>
>> Dimitris Kolovos wrote:
>>> Hi Mihir,
>>>
>>> In this case, you'd have to add a new derived volatile and transient
>>> attribute, and set it as the label of your ObjectTemplateExp like this:
>>>
>>> @gmf.node(label="label")
>>> class ObjectTemplateExp extends ExtendedOclExp {
>>> val VariableExp variable;
>>>
>>> derived transient volatile attr String label;
>>>
>>> @gmf.compartment(layout="list", collapsible="false")
>>> val PropertyTemplateExp[*] propertyTemplates;
>>> ref EClass referredClass;
>>> }
>>>
>>> When you generate the EMF code, you'll need to go into the generated
>>> ObjectTemplateExpImpl.getLabel() method, turn it to @generated NOT
>>> and make it return variable.name (instead of throwing an unsupported
>>> operation exception).
>>>
>>> Cheers,
>>> Dimitris
>>>
>>> Mihir wrote:
>>>> Hello,
>>>>
>>>> Below is the snippet from the .emf file. The output of the below
>>>> code resembles to the UML Object diagram where ObjectTemplateExp is
>>>> Object and PropertyTemplateExp is the attribute in the object.
>>>>
>>>> I want to fetch the value of attr "name" from VariableExp class and
>>>> show it as a label for ObjectTemplateExp node. Also, want to fetch
>>>> the name of the referred class so that the label pattern looks like
>>>> "variable : (name of referredClass)"
>>>>
>>>> Same for the label of PropertyTemplateExp "(name of
>>>> referredProperty) = value"
>>>>
>>>> Any help/pointers to help will be highly appreciated.
>>>>
>>>> code:
>>>>
>>>> @gmf.node(label="variable.name")
>>>> class ObjectTemplateExp extends ExtendedOclExp {
>>>> val VariableExp variable;
>>>>
>>>> @gmf.compartment(layout="list", collapsible="false")
>>>> val PropertyTemplateExp[*] propertyTemplates;
>>>> ref EClass referredClass;
>>>> }
>>>>
>>>> @gmf.node(label="name", label.icon="false", figure="rectangle")
>>>> class PropertyTemplateExp {
>>>> val ExtendedExp value;
>>>>
>>>> @gmf.link(target.decoration="arrow")
>>>> ref ecore.EStructuralFeature referredProperty;
>>>> }
>>>>
>>>> class VariableExp {
>>>> !unique !ordered attr String name;
>>>> }
>>>>
>>>>
>>>>
>>>> Thanks,
>>>> Mihir
Re: [EuGENia] Node label from attribute of contained class [message #110008 is a reply to message #80936] Mon, 27 July 2009 18:57 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Mihir,

Strange! Could you please send me your metamodel so that I can have a look?

Cheers,
Dimitris

Mihir wrote:
> Hi Dimitris,
>
> I did tried this couple of times. Deleted all the generated code and all
> those model files. Regenerated everything.. still it generates same
> code. :S
>
> Sorry for delayed reply.
>
> Cheers,
> Mihir
>
>
>
>
> Dimitris Kolovos wrote:
>> Hi Mihir,
>>
>> Could you please check again that you have all 3 modifiers in your
>> label attribute and that you have regenerated the .ecore from the .emf
>> and reloaded the .genmodel? (if necessary, please delete the .genmodel
>> and regenerate it).
>>
>> Cheers,
>> Dimitris
>>
>> Mihir wrote:
>>> Hello Dimitris,
>>>
>>> Sorry for delayed reply. I'd gone out for a while.
>>>
>>> I've implemented a derived attribute and generated all the code as
>>> told by you. But, what I saw is that it is same as adding a new
>>> simple attribute to the class because the generated code seems like
>>> the same as that generated for simple attribute. Below is the code
>>> that is generated. I can't find any code throwing unsupported
>>> operation exception.
>>>
>>>
>>> public String getLabel() {
>>> return
>>> (String)eGet(Moment2transformationPackage.Literals.OBJECT_TE MPLATE_EXP__LABEL,
>>> true);
>>> }
>>>
>>> public void setLabel(String newLabel) {
>>>
>>> eSet(Moment2transformationPackage.Literals.OBJECT_TEMPLATE_E XP__LABEL,
>>> newLabel);
>>> }
>>>
>>>
>>> Cheers,
>>> Mihir
>>>
>>>
>>>
>>> Dimitris Kolovos wrote:
>>>> Hi Mihir,
>>>>
>>>> In this case, you'd have to add a new derived volatile and transient
>>>> attribute, and set it as the label of your ObjectTemplateExp like this:
>>>>
>>>> @gmf.node(label="label")
>>>> class ObjectTemplateExp extends ExtendedOclExp {
>>>> val VariableExp variable;
>>>>
>>>> derived transient volatile attr String label;
>>>>
>>>> @gmf.compartment(layout="list", collapsible="false")
>>>> val PropertyTemplateExp[*] propertyTemplates;
>>>> ref EClass referredClass;
>>>> }
>>>>
>>>> When you generate the EMF code, you'll need to go into the generated
>>>> ObjectTemplateExpImpl.getLabel() method, turn it to @generated NOT
>>>> and make it return variable.name (instead of throwing an unsupported
>>>> operation exception).
>>>>
>>>> Cheers,
>>>> Dimitris
>>>>
>>>> Mihir wrote:
>>>>> Hello,
>>>>>
>>>>> Below is the snippet from the .emf file. The output of the below
>>>>> code resembles to the UML Object diagram where ObjectTemplateExp is
>>>>> Object and PropertyTemplateExp is the attribute in the object.
>>>>>
>>>>> I want to fetch the value of attr "name" from VariableExp class and
>>>>> show it as a label for ObjectTemplateExp node. Also, want to fetch
>>>>> the name of the referred class so that the label pattern looks like
>>>>> "variable : (name of referredClass)"
>>>>>
>>>>> Same for the label of PropertyTemplateExp "(name of
>>>>> referredProperty) = value"
>>>>>
>>>>> Any help/pointers to help will be highly appreciated.
>>>>>
>>>>> code:
>>>>>
>>>>> @gmf.node(label="variable.name")
>>>>> class ObjectTemplateExp extends ExtendedOclExp {
>>>>> val VariableExp variable;
>>>>>
>>>>> @gmf.compartment(layout="list", collapsible="false")
>>>>> val PropertyTemplateExp[*] propertyTemplates;
>>>>> ref EClass referredClass;
>>>>> }
>>>>>
>>>>> @gmf.node(label="name", label.icon="false", figure="rectangle")
>>>>> class PropertyTemplateExp {
>>>>> val ExtendedExp value;
>>>>>
>>>>> @gmf.link(target.decoration="arrow")
>>>>> ref ecore.EStructuralFeature referredProperty;
>>>>> }
>>>>>
>>>>> class VariableExp {
>>>>> !unique !ordered attr String name;
>>>>> }
>>>>>
>>>>>
>>>>>
>>>>> Thanks,
>>>>> Mihir
Re: [EuGENia] Node label from attribute of contained class [message #138345 is a reply to message #110008] Mon, 27 July 2009 19:22 Go to previous message
Mihir is currently offline MihirFriend
Messages: 83
Registered: July 2009
Member
Hi Dimitris,

I've mailed you on your id.

Cheers,
Mihir


Dimitris Kolovos wrote:
> Hi Mihir,
>
> Strange! Could you please send me your metamodel so that I can have a look?
>
> Cheers,
> Dimitris
>
> Mihir wrote:
>> Hi Dimitris,
>>
>> I did tried this couple of times. Deleted all the generated code and
>> all those model files. Regenerated everything.. still it generates
>> same code. :S
>>
>> Sorry for delayed reply.
>>
>> Cheers,
>> Mihir
>>
>>
>>
>>
>> Dimitris Kolovos wrote:
>>> Hi Mihir,
>>>
>>> Could you please check again that you have all 3 modifiers in your
>>> label attribute and that you have regenerated the .ecore from the
>>> .emf and reloaded the .genmodel? (if necessary, please delete the
>>> .genmodel and regenerate it).
>>>
>>> Cheers,
>>> Dimitris
>>>
>>> Mihir wrote:
>>>> Hello Dimitris,
>>>>
>>>> Sorry for delayed reply. I'd gone out for a while.
>>>>
>>>> I've implemented a derived attribute and generated all the code as
>>>> told by you. But, what I saw is that it is same as adding a new
>>>> simple attribute to the class because the generated code seems like
>>>> the same as that generated for simple attribute. Below is the code
>>>> that is generated. I can't find any code throwing unsupported
>>>> operation exception.
>>>>
>>>>
>>>> public String getLabel() {
>>>> return
>>>> (String)eGet(Moment2transformationPackage.Literals.OBJECT_TE MPLATE_EXP__LABEL,
>>>> true);
>>>> }
>>>>
>>>> public void setLabel(String newLabel) {
>>>>
>>>> eSet(Moment2transformationPackage.Literals.OBJECT_TEMPLATE_E XP__LABEL,
>>>> newLabel);
>>>> }
>>>>
>>>>
>>>> Cheers,
>>>> Mihir
>>>>
>>>>
>>>>
>>>> Dimitris Kolovos wrote:
>>>>> Hi Mihir,
>>>>>
>>>>> In this case, you'd have to add a new derived volatile and
>>>>> transient attribute, and set it as the label of your
>>>>> ObjectTemplateExp like this:
>>>>>
>>>>> @gmf.node(label="label")
>>>>> class ObjectTemplateExp extends ExtendedOclExp {
>>>>> val VariableExp variable;
>>>>>
>>>>> derived transient volatile attr String label;
>>>>>
>>>>> @gmf.compartment(layout="list", collapsible="false")
>>>>> val PropertyTemplateExp[*] propertyTemplates;
>>>>> ref EClass referredClass;
>>>>> }
>>>>>
>>>>> When you generate the EMF code, you'll need to go into the
>>>>> generated ObjectTemplateExpImpl.getLabel() method, turn it to
>>>>> @generated NOT and make it return variable.name (instead of
>>>>> throwing an unsupported operation exception).
>>>>>
>>>>> Cheers,
>>>>> Dimitris
>>>>>
>>>>> Mihir wrote:
>>>>>> Hello,
>>>>>>
>>>>>> Below is the snippet from the .emf file. The output of the below
>>>>>> code resembles to the UML Object diagram where ObjectTemplateExp
>>>>>> is Object and PropertyTemplateExp is the attribute in the object.
>>>>>>
>>>>>> I want to fetch the value of attr "name" from VariableExp class
>>>>>> and show it as a label for ObjectTemplateExp node. Also, want to
>>>>>> fetch the name of the referred class so that the label pattern
>>>>>> looks like "variable : (name of referredClass)"
>>>>>>
>>>>>> Same for the label of PropertyTemplateExp "(name of
>>>>>> referredProperty) = value"
>>>>>>
>>>>>> Any help/pointers to help will be highly appreciated.
>>>>>>
>>>>>> code:
>>>>>>
>>>>>> @gmf.node(label="variable.name")
>>>>>> class ObjectTemplateExp extends ExtendedOclExp {
>>>>>> val VariableExp variable;
>>>>>>
>>>>>> @gmf.compartment(layout="list", collapsible="false")
>>>>>> val PropertyTemplateExp[*] propertyTemplates;
>>>>>> ref EClass referredClass;
>>>>>> }
>>>>>>
>>>>>> @gmf.node(label="name", label.icon="false", figure="rectangle")
>>>>>> class PropertyTemplateExp {
>>>>>> val ExtendedExp value;
>>>>>>
>>>>>> @gmf.link(target.decoration="arrow")
>>>>>> ref ecore.EStructuralFeature referredProperty;
>>>>>> }
>>>>>>
>>>>>> class VariableExp {
>>>>>> !unique !ordered attr String name;
>>>>>> }
>>>>>>
>>>>>>
>>>>>>
>>>>>> Thanks,
>>>>>> Mihir
Re: [EuGENia] Node label from attribute of contained class [message #571120 is a reply to message #23406] Sun, 26 July 2009 11:08 Go to previous message
Mihir is currently offline MihirFriend
Messages: 83
Registered: July 2009
Member
Just to add further to my last post. I also want a simple reference link
to link a instance of ObjectTemplateExp to the other instance of
ObjectTemplateExp if the type of the referredProperty (in instance of
PropertyTemplateExp) is of type EReference.

Hope this all makes sense.

Thanks,
Mihir


Mihir wrote:
> Hello,
>
> Below is the snippet from the .emf file. The output of the below code
> resembles to the UML Object diagram where ObjectTemplateExp is Object
> and PropertyTemplateExp is the attribute in the object.
>
> I want to fetch the value of attr "name" from VariableExp class and show
> it as a label for ObjectTemplateExp node. Also, want to fetch the name
> of the referred class so that the label pattern looks like "variable :
> (name of referredClass)"
>
> Same for the label of PropertyTemplateExp "(name of referredProperty) =
> value"
>
> Any help/pointers to help will be highly appreciated.
>
> code:
>
> @gmf.node(label="variable.name")
> class ObjectTemplateExp extends ExtendedOclExp {
> val VariableExp variable;
>
> @gmf.compartment(layout="list", collapsible="false")
> val PropertyTemplateExp[*] propertyTemplates;
> ref EClass referredClass;
> }
>
> @gmf.node(label="name", label.icon="false", figure="rectangle")
> class PropertyTemplateExp {
> val ExtendedExp value;
>
> @gmf.link(target.decoration="arrow")
> ref ecore.EStructuralFeature referredProperty;
> }
>
> class VariableExp {
> !unique !ordered attr String name;
> }
>
>
>
> Thanks,
> Mihir
Re: [EuGENia] Node label from attribute of contained class [message #571170 is a reply to message #23406] Sun, 26 July 2009 11:24 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Mihir,

In this case, you'd have to add a new derived volatile and transient
attribute, and set it as the label of your ObjectTemplateExp like this:

@gmf.node(label="label")
class ObjectTemplateExp extends ExtendedOclExp {
val VariableExp variable;

derived transient volatile attr String label;

@gmf.compartment(layout="list", collapsible="false")
val PropertyTemplateExp[*] propertyTemplates;
ref EClass referredClass;
}

When you generate the EMF code, you'll need to go into the generated
ObjectTemplateExpImpl.getLabel() method, turn it to @generated NOT and
make it return variable.name (instead of throwing an unsupported
operation exception).

Cheers,
Dimitris

Mihir wrote:
> Hello,
>
> Below is the snippet from the .emf file. The output of the below code
> resembles to the UML Object diagram where ObjectTemplateExp is Object
> and PropertyTemplateExp is the attribute in the object.
>
> I want to fetch the value of attr "name" from VariableExp class and show
> it as a label for ObjectTemplateExp node. Also, want to fetch the name
> of the referred class so that the label pattern looks like "variable :
> (name of referredClass)"
>
> Same for the label of PropertyTemplateExp "(name of referredProperty) =
> value"
>
> Any help/pointers to help will be highly appreciated.
>
> code:
>
> @gmf.node(label="variable.name")
> class ObjectTemplateExp extends ExtendedOclExp {
> val VariableExp variable;
>
> @gmf.compartment(layout="list", collapsible="false")
> val PropertyTemplateExp[*] propertyTemplates;
> ref EClass referredClass;
> }
>
> @gmf.node(label="name", label.icon="false", figure="rectangle")
> class PropertyTemplateExp {
> val ExtendedExp value;
>
> @gmf.link(target.decoration="arrow")
> ref ecore.EStructuralFeature referredProperty;
> }
>
> class VariableExp {
> !unique !ordered attr String name;
> }
>
>
>
> Thanks,
> Mihir
Re: [EuGENia] Node label from attribute of contained class [message #571187 is a reply to message #23449] Sun, 26 July 2009 11:27 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Mihir,

I'm not sure I understand this :( Do you need links to be automatically
created between unlinked objects when a certain condition is satisfied?

Cheers,
Dimitris

Mihir wrote:
> Just to add further to my last post. I also want a simple reference link
> to link a instance of ObjectTemplateExp to the other instance of
> ObjectTemplateExp if the type of the referredProperty (in instance of
> PropertyTemplateExp) is of type EReference.
>
> Hope this all makes sense.
>
> Thanks,
> Mihir
>
>
> Mihir wrote:
>> Hello,
>>
>> Below is the snippet from the .emf file. The output of the below code
>> resembles to the UML Object diagram where ObjectTemplateExp is Object
>> and PropertyTemplateExp is the attribute in the object.
>>
>> I want to fetch the value of attr "name" from VariableExp class and
>> show it as a label for ObjectTemplateExp node. Also, want to fetch the
>> name of the referred class so that the label pattern looks like
>> "variable : (name of referredClass)"
>>
>> Same for the label of PropertyTemplateExp "(name of referredProperty)
>> = value"
>>
>> Any help/pointers to help will be highly appreciated.
>>
>> code:
>>
>> @gmf.node(label="variable.name")
>> class ObjectTemplateExp extends ExtendedOclExp {
>> val VariableExp variable;
>>
>> @gmf.compartment(layout="list", collapsible="false")
>> val PropertyTemplateExp[*] propertyTemplates;
>> ref EClass referredClass;
>> }
>>
>> @gmf.node(label="name", label.icon="false", figure="rectangle")
>> class PropertyTemplateExp {
>> val ExtendedExp value;
>>
>> @gmf.link(target.decoration="arrow")
>> ref ecore.EStructuralFeature referredProperty;
>> }
>>
>> class VariableExp {
>> !unique !ordered attr String name;
>> }
>>
>>
>>
>> Thanks,
>> Mihir
Re: [EuGENia] Node label from attribute of contained class [message #571209 is a reply to message #23534] Sun, 26 July 2009 11:41 Go to previous message
Mihir is currently offline MihirFriend
Messages: 83
Registered: July 2009
Member
Hello Dimitris,

Many thanks for your quick reply. I'll try and implement this and get
back to you soon. I don't if it is a feasible question but can we make
it work without adding that extra derived transient volatile attribute??
Because, the thing is I don't want to make any changes in the metamodel.
I'll still try your this suggested technique.

Thanks,
Mihir


Dimitris Kolovos wrote:
> Hi Mihir,
>
> In this case, you'd have to add a new derived volatile and transient
> attribute, and set it as the label of your ObjectTemplateExp like this:
>
> @gmf.node(label="label")
> class ObjectTemplateExp extends ExtendedOclExp {
> val VariableExp variable;
>
> derived transient volatile attr String label;
>
> @gmf.compartment(layout="list", collapsible="false")
> val PropertyTemplateExp[*] propertyTemplates;
> ref EClass referredClass;
> }
>
> When you generate the EMF code, you'll need to go into the generated
> ObjectTemplateExpImpl.getLabel() method, turn it to @generated NOT and
> make it return variable.name (instead of throwing an unsupported
> operation exception).
>
> Cheers,
> Dimitris
>
> Mihir wrote:
>> Hello,
>>
>> Below is the snippet from the .emf file. The output of the below code
>> resembles to the UML Object diagram where ObjectTemplateExp is Object
>> and PropertyTemplateExp is the attribute in the object.
>>
>> I want to fetch the value of attr "name" from VariableExp class and
>> show it as a label for ObjectTemplateExp node. Also, want to fetch the
>> name of the referred class so that the label pattern looks like
>> "variable : (name of referredClass)"
>>
>> Same for the label of PropertyTemplateExp "(name of referredProperty)
>> = value"
>>
>> Any help/pointers to help will be highly appreciated.
>>
>> code:
>>
>> @gmf.node(label="variable.name")
>> class ObjectTemplateExp extends ExtendedOclExp {
>> val VariableExp variable;
>>
>> @gmf.compartment(layout="list", collapsible="false")
>> val PropertyTemplateExp[*] propertyTemplates;
>> ref EClass referredClass;
>> }
>>
>> @gmf.node(label="name", label.icon="false", figure="rectangle")
>> class PropertyTemplateExp {
>> val ExtendedExp value;
>>
>> @gmf.link(target.decoration="arrow")
>> ref ecore.EStructuralFeature referredProperty;
>> }
>>
>> class VariableExp {
>> !unique !ordered attr String name;
>> }
>>
>>
>>
>> Thanks,
>> Mihir
Re: [EuGENia] Node label from attribute of contained class [message #571228 is a reply to message #23576] Sun, 26 July 2009 11:45 Go to previous message
Mihir is currently offline MihirFriend
Messages: 83
Registered: July 2009
Member
Hi Dimitris,

Thanks for you quick reply. I was meant to add the link manually from
tools palette. But, it would be great to achieve your idea as well.. ;)
Awaiting for your input. :)

Thanks,
Mihir


Dimitris Kolovos wrote:
> Hi Mihir,
>
> I'm not sure I understand this :( Do you need links to be automatically
> created between unlinked objects when a certain condition is satisfied?
>
> Cheers,
> Dimitris
>
> Mihir wrote:
>> Just to add further to my last post. I also want a simple reference
>> link to link a instance of ObjectTemplateExp to the other
>> instance of ObjectTemplateExp if the type of the referredProperty (in
>> instance of PropertyTemplateExp) is of type EReference.
>>
>> Hope this all makes sense.
>>
>> Thanks,
>> Mihir
>>
>>
>> Mihir wrote:
>>> Hello,
>>>
>>> Below is the snippet from the .emf file. The output of the below code
>>> resembles to the UML Object diagram where ObjectTemplateExp is Object
>>> and PropertyTemplateExp is the attribute in the object.
>>>
>>> I want to fetch the value of attr "name" from VariableExp class and
>>> show it as a label for ObjectTemplateExp node. Also, want to fetch
>>> the name of the referred class so that the label pattern looks like
>>> "variable : (name of referredClass)"
>>>
>>> Same for the label of PropertyTemplateExp "(name of referredProperty)
>>> = value"
>>>
>>> Any help/pointers to help will be highly appreciated.
>>>
>>> code:
>>>
>>> @gmf.node(label="variable.name")
>>> class ObjectTemplateExp extends ExtendedOclExp {
>>> val VariableExp variable;
>>>
>>> @gmf.compartment(layout="list", collapsible="false")
>>> val PropertyTemplateExp[*] propertyTemplates;
>>> ref EClass referredClass;
>>> }
>>>
>>> @gmf.node(label="name", label.icon="false", figure="rectangle")
>>> class PropertyTemplateExp {
>>> val ExtendedExp value;
>>>
>>> @gmf.link(target.decoration="arrow")
>>> ref ecore.EStructuralFeature referredProperty;
>>> }
>>>
>>> class VariableExp {
>>> !unique !ordered attr String name;
>>> }
>>>
>>>
>>>
>>> Thanks,
>>> Mihir
Re: [EuGENia] Node label from attribute of contained class [message #571272 is a reply to message #23704] Sun, 26 July 2009 11:52 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Mihir,

Mihir wrote:
> Hi Dimitris,
>
> Thanks for you quick reply. I was meant to add the link manually from
> tools palette.

So you actually want to prevent users from creating a link between the
two objects if the condition is not satisfied. I know that this is
possible using OCL but to be honest, I haven't ever played with this
feature. I'll look into this in the next few days and get back to you.
If by any chance you manage to make any progress with this before I do,
it'd be great if you could report back with the solution you've found.

> But, it would be great to achieve your idea as well.. ;)

It should be possible to do this in a batch mode using EWL. See

http://www.eclipse.org/gmt/epsilon/doc/ewl

and the example in

http://www.eclipse.org/gmt/epsilon/cinema/#GMFWizards2

for more details.

> Awaiting for your input. :)
>
> Thanks,
> Mihir
>

Cheers,
Dimitris
>
> Dimitris Kolovos wrote:
>> Hi Mihir,
>>
>> I'm not sure I understand this :( Do you need links to be
>> automatically created between unlinked objects when a certain
>> condition is satisfied?
>>
>> Cheers,
>> Dimitris
>>
>> Mihir wrote:
>>> Just to add further to my last post. I also want a simple reference
>>> link to link a instance of ObjectTemplateExp to the other
>>> instance of ObjectTemplateExp if the type of the referredProperty (in
>>> instance of PropertyTemplateExp) is of type EReference.
>>>
>>> Hope this all makes sense.
>>>
>>> Thanks,
>>> Mihir
>>>
>>>
>>> Mihir wrote:
>>>> Hello,
>>>>
>>>> Below is the snippet from the .emf file. The output of the below
>>>> code resembles to the UML Object diagram where ObjectTemplateExp is
>>>> Object and PropertyTemplateExp is the attribute in the object.
>>>>
>>>> I want to fetch the value of attr "name" from VariableExp class and
>>>> show it as a label for ObjectTemplateExp node. Also, want to fetch
>>>> the name of the referred class so that the label pattern looks like
>>>> "variable : (name of referredClass)"
>>>>
>>>> Same for the label of PropertyTemplateExp "(name of
>>>> referredProperty) = value"
>>>>
>>>> Any help/pointers to help will be highly appreciated.
>>>>
>>>> code:
>>>>
>>>> @gmf.node(label="variable.name")
>>>> class ObjectTemplateExp extends ExtendedOclExp {
>>>> val VariableExp variable;
>>>>
>>>> @gmf.compartment(layout="list", collapsible="false")
>>>> val PropertyTemplateExp[*] propertyTemplates;
>>>> ref EClass referredClass;
>>>> }
>>>>
>>>> @gmf.node(label="name", label.icon="false", figure="rectangle")
>>>> class PropertyTemplateExp {
>>>> val ExtendedExp value;
>>>>
>>>> @gmf.link(target.decoration="arrow")
>>>> ref ecore.EStructuralFeature referredProperty;
>>>> }
>>>>
>>>> class VariableExp {
>>>> !unique !ordered attr String name;
>>>> }
>>>>
>>>>
>>>>
>>>> Thanks,
>>>> Mihir
Re: [EuGENia] Node label from attribute of contained class [message #571295 is a reply to message #23662] Sun, 26 July 2009 11:54 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Mihir,

I don't know if it is possible to do this without adding that extra
attribute. Another question for the GMF newsgroup it seems ;)

Cheers,
Dimitris

Mihir wrote:
> Hello Dimitris,
>
> Many thanks for your quick reply. I'll try and implement this and get
> back to you soon. I don't if it is a feasible question but can we make
> it work without adding that extra derived transient volatile attribute??
> Because, the thing is I don't want to make any changes in the metamodel.
> I'll still try your this suggested technique.
>
> Thanks,
> Mihir
>
>
> Dimitris Kolovos wrote:
>> Hi Mihir,
>>
>> In this case, you'd have to add a new derived volatile and transient
>> attribute, and set it as the label of your ObjectTemplateExp like this:
>>
>> @gmf.node(label="label")
>> class ObjectTemplateExp extends ExtendedOclExp {
>> val VariableExp variable;
>>
>> derived transient volatile attr String label;
>>
>> @gmf.compartment(layout="list", collapsible="false")
>> val PropertyTemplateExp[*] propertyTemplates;
>> ref EClass referredClass;
>> }
>>
>> When you generate the EMF code, you'll need to go into the generated
>> ObjectTemplateExpImpl.getLabel() method, turn it to @generated NOT and
>> make it return variable.name (instead of throwing an unsupported
>> operation exception).
>>
>> Cheers,
>> Dimitris
>>
>> Mihir wrote:
>>> Hello,
>>>
>>> Below is the snippet from the .emf file. The output of the below code
>>> resembles to the UML Object diagram where ObjectTemplateExp is Object
>>> and PropertyTemplateExp is the attribute in the object.
>>>
>>> I want to fetch the value of attr "name" from VariableExp class and
>>> show it as a label for ObjectTemplateExp node. Also, want to fetch
>>> the name of the referred class so that the label pattern looks like
>>> "variable : (name of referredClass)"
>>>
>>> Same for the label of PropertyTemplateExp "(name of referredProperty)
>>> = value"
>>>
>>> Any help/pointers to help will be highly appreciated.
>>>
>>> code:
>>>
>>> @gmf.node(label="variable.name")
>>> class ObjectTemplateExp extends ExtendedOclExp {
>>> val VariableExp variable;
>>>
>>> @gmf.compartment(layout="list", collapsible="false")
>>> val PropertyTemplateExp[*] propertyTemplates;
>>> ref EClass referredClass;
>>> }
>>>
>>> @gmf.node(label="name", label.icon="false", figure="rectangle")
>>> class PropertyTemplateExp {
>>> val ExtendedExp value;
>>>
>>> @gmf.link(target.decoration="arrow")
>>> ref ecore.EStructuralFeature referredProperty;
>>> }
>>>
>>> class VariableExp {
>>> !unique !ordered attr String name;
>>> }
>>>
>>>
>>>
>>> Thanks,
>>> Mihir
Re: [EuGENia] Node label from attribute of contained class [message #571306 is a reply to message #23785] Sun, 26 July 2009 12:11 Go to previous message
Mihir is currently offline MihirFriend
Messages: 83
Registered: July 2009
Member
OK Dimitris,

I'm looking at the links sent by you. And I'll update you if I found
anything.

Meanwhile, I've this 1 stupid question. It is related to GMF but, still
asking if you know any solution for this. The description of question is
once I've generated all the codes for the editor and tested it. Then, I
update the definition in .emf file and generate all the required codes.
Now if I've removed anything from the .emf ( for example I remove a link
annotation) and then generate the code I get error in the generated
code. If I delete all the code and regenerate it, it works fine. Just
wondering if you have any solution for this.

Cheers,
Mihir



Dimitris Kolovos wrote:
> Hi Mihir,
>
> Mihir wrote:
>> Hi Dimitris,
>>
>> Thanks for you quick reply. I was meant to add the link manually from
>> tools palette.
>
> So you actually want to prevent users from creating a link between the
> two objects if the condition is not satisfied. I know that this is
> possible using OCL but to be honest, I haven't ever played with this
> feature. I'll look into this in the next few days and get back to you.
> If by any chance you manage to make any progress with this before I do,
> it'd be great if you could report back with the solution you've found.
>
>> But, it would be great to achieve your idea as well.. ;)
>
> It should be possible to do this in a batch mode using EWL. See
>
> http://www.eclipse.org/gmt/epsilon/doc/ewl
>
> and the example in
>
> http://www.eclipse.org/gmt/epsilon/cinema/#GMFWizards2
>
> for more details.
>
>> Awaiting for your input. :)
>>
>> Thanks,
>> Mihir
>>
>
> Cheers,
> Dimitris
>>
>> Dimitris Kolovos wrote:
>>> Hi Mihir,
>>>
>>> I'm not sure I understand this :( Do you need links to be
>>> automatically created between unlinked objects when a certain
>>> condition is satisfied?
>>>
>>> Cheers,
>>> Dimitris
>>>
>>> Mihir wrote:
>>>> Just to add further to my last post. I also want a simple reference
>>>> link to link a instance of ObjectTemplateExp to the other
>>>> instance of ObjectTemplateExp if the type of the referredProperty
>>>> (in instance of PropertyTemplateExp) is of type EReference.
>>>>
>>>> Hope this all makes sense.
>>>>
>>>> Thanks,
>>>> Mihir
>>>>
>>>>
>>>> Mihir wrote:
>>>>> Hello,
>>>>>
>>>>> Below is the snippet from the .emf file. The output of the below
>>>>> code resembles to the UML Object diagram where ObjectTemplateExp is
>>>>> Object and PropertyTemplateExp is the attribute in the object.
>>>>>
>>>>> I want to fetch the value of attr "name" from VariableExp class and
>>>>> show it as a label for ObjectTemplateExp node. Also, want to fetch
>>>>> the name of the referred class so that the label pattern looks like
>>>>> "variable : (name of referredClass)"
>>>>>
>>>>> Same for the label of PropertyTemplateExp "(name of
>>>>> referredProperty) = value"
>>>>>
>>>>> Any help/pointers to help will be highly appreciated.
>>>>>
>>>>> code:
>>>>>
>>>>> @gmf.node(label="variable.name")
>>>>> class ObjectTemplateExp extends ExtendedOclExp {
>>>>> val VariableExp variable;
>>>>>
>>>>> @gmf.compartment(layout="list", collapsible="false")
>>>>> val PropertyTemplateExp[*] propertyTemplates;
>>>>> ref EClass referredClass;
>>>>> }
>>>>>
>>>>> @gmf.node(label="name", label.icon="false", figure="rectangle")
>>>>> class PropertyTemplateExp {
>>>>> val ExtendedExp value;
>>>>>
>>>>> @gmf.link(target.decoration="arrow")
>>>>> ref ecore.EStructuralFeature referredProperty;
>>>>> }
>>>>>
>>>>> class VariableExp {
>>>>> !unique !ordered attr String name;
>>>>> }
>>>>>
>>>>>
>>>>>
>>>>> Thanks,
>>>>> Mihir
Re: [EuGENia] Node label from attribute of contained class [message #571321 is a reply to message #23868] Sun, 26 July 2009 12:16 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Mihir,

This is reasonable as the generator doesn't attempt to delete files that
it generated in a previous run but are not necessary any more.

Cheers,
Dimitris

Mihir wrote:
> OK Dimitris,
>
> I'm looking at the links sent by you. And I'll update you if I found
> anything.
>
> Meanwhile, I've this 1 stupid question. It is related to GMF but, still
> asking if you know any solution for this. The description of question is
> once I've generated all the codes for the editor and tested it. Then, I
> update the definition in .emf file and generate all the required codes.
> Now if I've removed anything from the .emf ( for example I remove a link
> annotation) and then generate the code I get error in the generated
> code. If I delete all the code and regenerate it, it works fine. Just
> wondering if you have any solution for this.
>
> Cheers,
> Mihir
>
>
>
> Dimitris Kolovos wrote:
>> Hi Mihir,
>>
>> Mihir wrote:
>>> Hi Dimitris,
>>>
>>> Thanks for you quick reply. I was meant to add the link manually from
>>> tools palette.
>>
>> So you actually want to prevent users from creating a link between the
>> two objects if the condition is not satisfied. I know that this is
>> possible using OCL but to be honest, I haven't ever played with this
>> feature. I'll look into this in the next few days and get back to you.
>> If by any chance you manage to make any progress with this before I
>> do, it'd be great if you could report back with the solution you've
>> found.
>>
>>> But, it would be great to achieve your idea as well.. ;)
>>
>> It should be possible to do this in a batch mode using EWL. See
>>
>> http://www.eclipse.org/gmt/epsilon/doc/ewl
>>
>> and the example in
>>
>> http://www.eclipse.org/gmt/epsilon/cinema/#GMFWizards2
>>
>> for more details.
>>
>>> Awaiting for your input. :)
>>>
>>> Thanks,
>>> Mihir
>>>
>>
>> Cheers,
>> Dimitris
>>>
>>> Dimitris Kolovos wrote:
>>>> Hi Mihir,
>>>>
>>>> I'm not sure I understand this :( Do you need links to be
>>>> automatically created between unlinked objects when a certain
>>>> condition is satisfied?
>>>>
>>>> Cheers,
>>>> Dimitris
>>>>
>>>> Mihir wrote:
>>>>> Just to add further to my last post. I also want a simple reference
>>>>> link to link a instance of ObjectTemplateExp to the other
>>>>> instance of ObjectTemplateExp if the type of the referredProperty
>>>>> (in instance of PropertyTemplateExp) is of type EReference.
>>>>>
>>>>> Hope this all makes sense.
>>>>>
>>>>> Thanks,
>>>>> Mihir
>>>>>
>>>>>
>>>>> Mihir wrote:
>>>>>> Hello,
>>>>>>
>>>>>> Below is the snippet from the .emf file. The output of the below
>>>>>> code resembles to the UML Object diagram where ObjectTemplateExp
>>>>>> is Object and PropertyTemplateExp is the attribute in the object.
>>>>>>
>>>>>> I want to fetch the value of attr "name" from VariableExp class
>>>>>> and show it as a label for ObjectTemplateExp node. Also, want to
>>>>>> fetch the name of the referred class so that the label pattern
>>>>>> looks like "variable : (name of referredClass)"
>>>>>>
>>>>>> Same for the label of PropertyTemplateExp "(name of
>>>>>> referredProperty) = value"
>>>>>>
>>>>>> Any help/pointers to help will be highly appreciated.
>>>>>>
>>>>>> code:
>>>>>>
>>>>>> @gmf.node(label="variable.name")
>>>>>> class ObjectTemplateExp extends ExtendedOclExp {
>>>>>> val VariableExp variable;
>>>>>>
>>>>>> @gmf.compartment(layout="list", collapsible="false")
>>>>>> val PropertyTemplateExp[*] propertyTemplates;
>>>>>> ref EClass referredClass;
>>>>>> }
>>>>>>
>>>>>> @gmf.node(label="name", label.icon="false", figure="rectangle")
>>>>>> class PropertyTemplateExp {
>>>>>> val ExtendedExp value;
>>>>>>
>>>>>> @gmf.link(target.decoration="arrow")
>>>>>> ref ecore.EStructuralFeature referredProperty;
>>>>>> }
>>>>>>
>>>>>> class VariableExp {
>>>>>> !unique !ordered attr String name;
>>>>>> }
>>>>>>
>>>>>>
>>>>>>
>>>>>> Thanks,
>>>>>> Mihir
Re: [EuGENia] Node label from attribute of contained class [message #571342 is a reply to message #23909] Sun, 26 July 2009 12:23 Go to previous message
Mihir is currently offline MihirFriend
Messages: 83
Registered: July 2009
Member
So I'll have to delete the generated code before generating new code.
I'll have to keep track if I've made any changes in the generated code
and make those changes again. Arghhh!!

Anyways thanks a million for your quick response. I'm newbie in this
group and even to the GMF stuffs.

Cheers,
Mihir


Dimitris Kolovos wrote:
> Hi Mihir,
>
> This is reasonable as the generator doesn't attempt to delete files that
> it generated in a previous run but are not necessary any more.
>
> Cheers,
> Dimitris
>
> Mihir wrote:
>> OK Dimitris,
>>
>> I'm looking at the links sent by you. And I'll update you if I found
>> anything.
>>
>> Meanwhile, I've this 1 stupid question. It is related to GMF but,
>> still asking if you know any solution for this. The description of
>> question is once I've generated all the codes for the editor and
>> tested it. Then, I update the definition in .emf file and generate all
>> the required codes. Now if I've removed anything from the .emf ( for
>> example I remove a link annotation) and then generate the code I get
>> error in the generated code. If I delete all the code and regenerate
>> it, it works fine. Just wondering if you have any solution for this.
>>
>> Cheers,
>> Mihir
>>
>>
>>
>> Dimitris Kolovos wrote:
>>> Hi Mihir,
>>>
>>> Mihir wrote:
>>>> Hi Dimitris,
>>>>
>>>> Thanks for you quick reply. I was meant to add the link manually
>>>> from tools palette.
>>>
>>> So you actually want to prevent users from creating a link between
>>> the two objects if the condition is not satisfied. I know that this
>>> is possible using OCL but to be honest, I haven't ever played with
>>> this feature. I'll look into this in the next few days and get back
>>> to you. If by any chance you manage to make any progress with this
>>> before I do, it'd be great if you could report back with the solution
>>> you've found.
>>>
>>>> But, it would be great to achieve your idea as well.. ;)
>>>
>>> It should be possible to do this in a batch mode using EWL. See
>>>
>>> http://www.eclipse.org/gmt/epsilon/doc/ewl
>>>
>>> and the example in
>>>
>>> http://www.eclipse.org/gmt/epsilon/cinema/#GMFWizards2
>>>
>>> for more details.
>>>
>>>> Awaiting for your input. :)
>>>>
>>>> Thanks,
>>>> Mihir
>>>>
>>>
>>> Cheers,
>>> Dimitris
>>>>
>>>> Dimitris Kolovos wrote:
>>>>> Hi Mihir,
>>>>>
>>>>> I'm not sure I understand this :( Do you need links to be
>>>>> automatically created between unlinked objects when a certain
>>>>> condition is satisfied?
>>>>>
>>>>> Cheers,
>>>>> Dimitris
>>>>>
>>>>> Mihir wrote:
>>>>>> Just to add further to my last post. I also want a simple
>>>>>> reference link to link a instance of ObjectTemplateExp to the
>>>>>> other instance of ObjectTemplateExp if the type of the
>>>>>> referredProperty (in instance of PropertyTemplateExp) is of type
>>>>>> EReference.
>>>>>>
>>>>>> Hope this all makes sense.
>>>>>>
>>>>>> Thanks,
>>>>>> Mihir
>>>>>>
>>>>>>
>>>>>> Mihir wrote:
>>>>>>> Hello,
>>>>>>>
>>>>>>> Below is the snippet from the .emf file. The output of the below
>>>>>>> code resembles to the UML Object diagram where ObjectTemplateExp
>>>>>>> is Object and PropertyTemplateExp is the attribute in the object.
>>>>>>>
>>>>>>> I want to fetch the value of attr "name" from VariableExp class
>>>>>>> and show it as a label for ObjectTemplateExp node. Also, want to
>>>>>>> fetch the name of the referred class so that the label pattern
>>>>>>> looks like "variable : (name of referredClass)"
>>>>>>>
>>>>>>> Same for the label of PropertyTemplateExp "(name of
>>>>>>> referredProperty) = value"
>>>>>>>
>>>>>>> Any help/pointers to help will be highly appreciated.
>>>>>>>
>>>>>>> code:
>>>>>>>
>>>>>>> @gmf.node(label="variable.name")
>>>>>>> class ObjectTemplateExp extends ExtendedOclExp {
>>>>>>> val VariableExp variable;
>>>>>>>
>>>>>>> @gmf.compartment(layout="list", collapsible="false")
>>>>>>> val PropertyTemplateExp[*] propertyTemplates;
>>>>>>> ref EClass referredClass;
>>>>>>> }
>>>>>>>
>>>>>>> @gmf.node(label="name", label.icon="false", figure="rectangle")
>>>>>>> class PropertyTemplateExp {
>>>>>>> val ExtendedExp value;
>>>>>>>
>>>>>>> @gmf.link(target.decoration="arrow")
>>>>>>> ref ecore.EStructuralFeature referredProperty;
>>>>>>> }
>>>>>>>
>>>>>>> class VariableExp {
>>>>>>> !unique !ordered attr String name;
>>>>>>> }
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Mihir
Re: [EuGENia] Node label from attribute of contained class [message #571357 is a reply to message #23534] Sun, 26 July 2009 19:22 Go to previous message
Mihir is currently offline MihirFriend
Messages: 83
Registered: July 2009
Member
Hello Dimitris,

Sorry for delayed reply. I'd gone out for a while.

I've implemented a derived attribute and generated all the code as told
by you. But, what I saw is that it is same as adding a new simple
attribute to the class because the generated code seems like the same as
that generated for simple attribute. Below is the code that is
generated. I can't find any code throwing unsupported operation exception.


public String getLabel() {
return
(String)eGet(Moment2transformationPackage.Literals.OBJECT_TE MPLATE_EXP__LABEL,
true);
}

public void setLabel(String newLabel) {
eSet(Moment2transformationPackage.Literals.OBJECT_TEMPLATE_E XP__LABEL,
newLabel);
}


Cheers,
Mihir



Dimitris Kolovos wrote:
> Hi Mihir,
>
> In this case, you'd have to add a new derived volatile and transient
> attribute, and set it as the label of your ObjectTemplateExp like this:
>
> @gmf.node(label="label")
> class ObjectTemplateExp extends ExtendedOclExp {
> val VariableExp variable;
>
> derived transient volatile attr String label;
>
> @gmf.compartment(layout="list", collapsible="false")
> val PropertyTemplateExp[*] propertyTemplates;
> ref EClass referredClass;
> }
>
> When you generate the EMF code, you'll need to go into the generated
> ObjectTemplateExpImpl.getLabel() method, turn it to @generated NOT and
> make it return variable.name (instead of throwing an unsupported
> operation exception).
>
> Cheers,
> Dimitris
>
> Mihir wrote:
>> Hello,
>>
>> Below is the snippet from the .emf file. The output of the below code
>> resembles to the UML Object diagram where ObjectTemplateExp is Object
>> and PropertyTemplateExp is the attribute in the object.
>>
>> I want to fetch the value of attr "name" from VariableExp class and
>> show it as a label for ObjectTemplateExp node. Also, want to fetch the
>> name of the referred class so that the label pattern looks like
>> "variable : (name of referredClass)"
>>
>> Same for the label of PropertyTemplateExp "(name of referredProperty)
>> = value"
>>
>> Any help/pointers to help will be highly appreciated.
>>
>> code:
>>
>> @gmf.node(label="variable.name")
>> class ObjectTemplateExp extends ExtendedOclExp {
>> val VariableExp variable;
>>
>> @gmf.compartment(layout="list", collapsible="false")
>> val PropertyTemplateExp[*] propertyTemplates;
>> ref EClass referredClass;
>> }
>>
>> @gmf.node(label="name", label.icon="false", figure="rectangle")
>> class PropertyTemplateExp {
>> val ExtendedExp value;
>>
>> @gmf.link(target.decoration="arrow")
>> ref ecore.EStructuralFeature referredProperty;
>> }
>>
>> class VariableExp {
>> !unique !ordered attr String name;
>> }
>>
>>
>>
>> Thanks,
>> Mihir
Re: [EuGENia] Node label from attribute of contained class [message #571381 is a reply to message #23987] Mon, 27 July 2009 12:03 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Mihir,

Could you please check again that you have all 3 modifiers in your label
attribute and that you have regenerated the .ecore from the .emf and
reloaded the .genmodel? (if necessary, please delete the .genmodel and
regenerate it).

Cheers,
Dimitris

Mihir wrote:
> Hello Dimitris,
>
> Sorry for delayed reply. I'd gone out for a while.
>
> I've implemented a derived attribute and generated all the code as told
> by you. But, what I saw is that it is same as adding a new simple
> attribute to the class because the generated code seems like the same as
> that generated for simple attribute. Below is the code that is
> generated. I can't find any code throwing unsupported operation exception.
>
>
> public String getLabel() {
> return
> (String)eGet(Moment2transformationPackage.Literals.OBJECT_TE MPLATE_EXP__LABEL,
> true);
> }
>
> public void setLabel(String newLabel) {
> eSet(Moment2transformationPackage.Literals.OBJECT_TEMPLATE_E XP__LABEL,
> newLabel);
> }
>
>
> Cheers,
> Mihir
>
>
>
> Dimitris Kolovos wrote:
>> Hi Mihir,
>>
>> In this case, you'd have to add a new derived volatile and transient
>> attribute, and set it as the label of your ObjectTemplateExp like this:
>>
>> @gmf.node(label="label")
>> class ObjectTemplateExp extends ExtendedOclExp {
>> val VariableExp variable;
>>
>> derived transient volatile attr String label;
>>
>> @gmf.compartment(layout="list", collapsible="false")
>> val PropertyTemplateExp[*] propertyTemplates;
>> ref EClass referredClass;
>> }
>>
>> When you generate the EMF code, you'll need to go into the generated
>> ObjectTemplateExpImpl.getLabel() method, turn it to @generated NOT and
>> make it return variable.name (instead of throwing an unsupported
>> operation exception).
>>
>> Cheers,
>> Dimitris
>>
>> Mihir wrote:
>>> Hello,
>>>
>>> Below is the snippet from the .emf file. The output of the below code
>>> resembles to the UML Object diagram where ObjectTemplateExp is Object
>>> and PropertyTemplateExp is the attribute in the object.
>>>
>>> I want to fetch the value of attr "name" from VariableExp class and
>>> show it as a label for ObjectTemplateExp node. Also, want to fetch
>>> the name of the referred class so that the label pattern looks like
>>> "variable : (name of referredClass)"
>>>
>>> Same for the label of PropertyTemplateExp "(name of referredProperty)
>>> = value"
>>>
>>> Any help/pointers to help will be highly appreciated.
>>>
>>> code:
>>>
>>> @gmf.node(label="variable.name")
>>> class ObjectTemplateExp extends ExtendedOclExp {
>>> val VariableExp variable;
>>>
>>> @gmf.compartment(layout="list", collapsible="false")
>>> val PropertyTemplateExp[*] propertyTemplates;
>>> ref EClass referredClass;
>>> }
>>>
>>> @gmf.node(label="name", label.icon="false", figure="rectangle")
>>> class PropertyTemplateExp {
>>> val ExtendedExp value;
>>>
>>> @gmf.link(target.decoration="arrow")
>>> ref ecore.EStructuralFeature referredProperty;
>>> }
>>>
>>> class VariableExp {
>>> !unique !ordered attr String name;
>>> }
>>>
>>>
>>>
>>> Thanks,
>>> Mihir
Re: [EuGENia] Node label from attribute of contained class [message #571412 is a reply to message #24024] Mon, 27 July 2009 18:29 Go to previous message
Mihir is currently offline MihirFriend
Messages: 83
Registered: July 2009
Member
Hi Dimitris,

I did tried this couple of times. Deleted all the generated code and all
those model files. Regenerated everything.. still it generates same code. :S

Sorry for delayed reply.

Cheers,
Mihir




Dimitris Kolovos wrote:
> Hi Mihir,
>
> Could you please check again that you have all 3 modifiers in your label
> attribute and that you have regenerated the .ecore from the .emf and
> reloaded the .genmodel? (if necessary, please delete the .genmodel and
> regenerate it).
>
> Cheers,
> Dimitris
>
> Mihir wrote:
>> Hello Dimitris,
>>
>> Sorry for delayed reply. I'd gone out for a while.
>>
>> I've implemented a derived attribute and generated all the code as
>> told by you. But, what I saw is that it is same as adding a new simple
>> attribute to the class because the generated code seems like the same
>> as that generated for simple attribute. Below is the code that is
>> generated. I can't find any code throwing unsupported operation
>> exception.
>>
>>
>> public String getLabel() {
>> return
>> (String)eGet(Moment2transformationPackage.Literals.OBJECT_TE MPLATE_EXP__LABEL,
>> true);
>> }
>>
>> public void setLabel(String newLabel) {
>>
>> eSet(Moment2transformationPackage.Literals.OBJECT_TEMPLATE_E XP__LABEL,
>> newLabel);
>> }
>>
>>
>> Cheers,
>> Mihir
>>
>>
>>
>> Dimitris Kolovos wrote:
>>> Hi Mihir,
>>>
>>> In this case, you'd have to add a new derived volatile and transient
>>> attribute, and set it as the label of your ObjectTemplateExp like this:
>>>
>>> @gmf.node(label="label")
>>> class ObjectTemplateExp extends ExtendedOclExp {
>>> val VariableExp variable;
>>>
>>> derived transient volatile attr String label;
>>>
>>> @gmf.compartment(layout="list", collapsible="false")
>>> val PropertyTemplateExp[*] propertyTemplates;
>>> ref EClass referredClass;
>>> }
>>>
>>> When you generate the EMF code, you'll need to go into the generated
>>> ObjectTemplateExpImpl.getLabel() method, turn it to @generated NOT
>>> and make it return variable.name (instead of throwing an unsupported
>>> operation exception).
>>>
>>> Cheers,
>>> Dimitris
>>>
>>> Mihir wrote:
>>>> Hello,
>>>>
>>>> Below is the snippet from the .emf file. The output of the below
>>>> code resembles to the UML Object diagram where ObjectTemplateExp is
>>>> Object and PropertyTemplateExp is the attribute in the object.
>>>>
>>>> I want to fetch the value of attr "name" from VariableExp class and
>>>> show it as a label for ObjectTemplateExp node. Also, want to fetch
>>>> the name of the referred class so that the label pattern looks like
>>>> "variable : (name of referredClass)"
>>>>
>>>> Same for the label of PropertyTemplateExp "(name of
>>>> referredProperty) = value"
>>>>
>>>> Any help/pointers to help will be highly appreciated.
>>>>
>>>> code:
>>>>
>>>> @gmf.node(label="variable.name")
>>>> class ObjectTemplateExp extends ExtendedOclExp {
>>>> val VariableExp variable;
>>>>
>>>> @gmf.compartment(layout="list", collapsible="false")
>>>> val PropertyTemplateExp[*] propertyTemplates;
>>>> ref EClass referredClass;
>>>> }
>>>>
>>>> @gmf.node(label="name", label.icon="false", figure="rectangle")
>>>> class PropertyTemplateExp {
>>>> val ExtendedExp value;
>>>>
>>>> @gmf.link(target.decoration="arrow")
>>>> ref ecore.EStructuralFeature referredProperty;
>>>> }
>>>>
>>>> class VariableExp {
>>>> !unique !ordered attr String name;
>>>> }
>>>>
>>>>
>>>>
>>>> Thanks,
>>>> Mihir
Re: [EuGENia] Node label from attribute of contained class [message #571433 is a reply to message #80936] Mon, 27 July 2009 18:57 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Mihir,

Strange! Could you please send me your metamodel so that I can have a look?

Cheers,
Dimitris

Mihir wrote:
> Hi Dimitris,
>
> I did tried this couple of times. Deleted all the generated code and all
> those model files. Regenerated everything.. still it generates same
> code. :S
>
> Sorry for delayed reply.
>
> Cheers,
> Mihir
>
>
>
>
> Dimitris Kolovos wrote:
>> Hi Mihir,
>>
>> Could you please check again that you have all 3 modifiers in your
>> label attribute and that you have regenerated the .ecore from the .emf
>> and reloaded the .genmodel? (if necessary, please delete the .genmodel
>> and regenerate it).
>>
>> Cheers,
>> Dimitris
>>
>> Mihir wrote:
>>> Hello Dimitris,
>>>
>>> Sorry for delayed reply. I'd gone out for a while.
>>>
>>> I've implemented a derived attribute and generated all the code as
>>> told by you. But, what I saw is that it is same as adding a new
>>> simple attribute to the class because the generated code seems like
>>> the same as that generated for simple attribute. Below is the code
>>> that is generated. I can't find any code throwing unsupported
>>> operation exception.
>>>
>>>
>>> public String getLabel() {
>>> return
>>> (String)eGet(Moment2transformationPackage.Literals.OBJECT_TE MPLATE_EXP__LABEL,
>>> true);
>>> }
>>>
>>> public void setLabel(String newLabel) {
>>>
>>> eSet(Moment2transformationPackage.Literals.OBJECT_TEMPLATE_E XP__LABEL,
>>> newLabel);
>>> }
>>>
>>>
>>> Cheers,
>>> Mihir
>>>
>>>
>>>
>>> Dimitris Kolovos wrote:
>>>> Hi Mihir,
>>>>
>>>> In this case, you'd have to add a new derived volatile and transient
>>>> attribute, and set it as the label of your ObjectTemplateExp like this:
>>>>
>>>> @gmf.node(label="label")
>>>> class ObjectTemplateExp extends ExtendedOclExp {
>>>> val VariableExp variable;
>>>>
>>>> derived transient volatile attr String label;
>>>>
>>>> @gmf.compartment(layout="list", collapsible="false")
>>>> val PropertyTemplateExp[*] propertyTemplates;
>>>> ref EClass referredClass;
>>>> }
>>>>
>>>> When you generate the EMF code, you'll need to go into the generated
>>>> ObjectTemplateExpImpl.getLabel() method, turn it to @generated NOT
>>>> and make it return variable.name (instead of throwing an unsupported
>>>> operation exception).
>>>>
>>>> Cheers,
>>>> Dimitris
>>>>
>>>> Mihir wrote:
>>>>> Hello,
>>>>>
>>>>> Below is the snippet from the .emf file. The output of the below
>>>>> code resembles to the UML Object diagram where ObjectTemplateExp is
>>>>> Object and PropertyTemplateExp is the attribute in the object.
>>>>>
>>>>> I want to fetch the value of attr "name" from VariableExp class and
>>>>> show it as a label for ObjectTemplateExp node. Also, want to fetch
>>>>> the name of the referred class so that the label pattern looks like
>>>>> "variable : (name of referredClass)"
>>>>>
>>>>> Same for the label of PropertyTemplateExp "(name of
>>>>> referredProperty) = value"
>>>>>
>>>>> Any help/pointers to help will be highly appreciated.
>>>>>
>>>>> code:
>>>>>
>>>>> @gmf.node(label="variable.name")
>>>>> class ObjectTemplateExp extends ExtendedOclExp {
>>>>> val VariableExp variable;
>>>>>
>>>>> @gmf.compartment(layout="list", collapsible="false")
>>>>> val PropertyTemplateExp[*] propertyTemplates;
>>>>> ref EClass referredClass;
>>>>> }
>>>>>
>>>>> @gmf.node(label="name", label.icon="false", figure="rectangle")
>>>>> class PropertyTemplateExp {
>>>>> val ExtendedExp value;
>>>>>
>>>>> @gmf.link(target.decoration="arrow")
>>>>> ref ecore.EStructuralFeature referredProperty;
>>>>> }
>>>>>
>>>>> class VariableExp {
>>>>> !unique !ordered attr String name;
>>>>> }
>>>>>
>>>>>
>>>>>
>>>>> Thanks,
>>>>> Mihir
Re: [EuGENia] Node label from attribute of contained class [message #571468 is a reply to message #110008] Mon, 27 July 2009 19:22 Go to previous message
Mihir is currently offline MihirFriend
Messages: 83
Registered: July 2009
Member
Hi Dimitris,

I've mailed you on your id.

Cheers,
Mihir


Dimitris Kolovos wrote:
> Hi Mihir,
>
> Strange! Could you please send me your metamodel so that I can have a look?
>
> Cheers,
> Dimitris
>
> Mihir wrote:
>> Hi Dimitris,
>>
>> I did tried this couple of times. Deleted all the generated code and
>> all those model files. Regenerated everything.. still it generates
>> same code. :S
>>
>> Sorry for delayed reply.
>>
>> Cheers,
>> Mihir
>>
>>
>>
>>
>> Dimitris Kolovos wrote:
>>> Hi Mihir,
>>>
>>> Could you please check again that you have all 3 modifiers in your
>>> label attribute and that you have regenerated the .ecore from the
>>> .emf and reloaded the .genmodel? (if necessary, please delete the
>>> .genmodel and regenerate it).
>>>
>>> Cheers,
>>> Dimitris
>>>
>>> Mihir wrote:
>>>> Hello Dimitris,
>>>>
>>>> Sorry for delayed reply. I'd gone out for a while.
>>>>
>>>> I've implemented a derived attribute and generated all the code as
>>>> told by you. But, what I saw is that it is same as adding a new
>>>> simple attribute to the class because the generated code seems like
>>>> the same as that generated for simple attribute. Below is the code
>>>> that is generated. I can't find any code throwing unsupported
>>>> operation exception.
>>>>
>>>>
>>>> public String getLabel() {
>>>> return
>>>> (String)eGet(Moment2transformationPackage.Literals.OBJECT_TE MPLATE_EXP__LABEL,
>>>> true);
>>>> }
>>>>
>>>> public void setLabel(String newLabel) {
>>>>
>>>> eSet(Moment2transformationPackage.Literals.OBJECT_TEMPLATE_E XP__LABEL,
>>>> newLabel);
>>>> }
>>>>
>>>>
>>>> Cheers,
>>>> Mihir
>>>>
>>>>
>>>>
>>>> Dimitris Kolovos wrote:
>>>>> Hi Mihir,
>>>>>
>>>>> In this case, you'd have to add a new derived volatile and
>>>>> transient attribute, and set it as the label of your
>>>>> ObjectTemplateExp like this:
>>>>>
>>>>> @gmf.node(label="label")
>>>>> class ObjectTemplateExp extends ExtendedOclExp {
>>>>> val VariableExp variable;
>>>>>
>>>>> derived transient volatile attr String label;
>>>>>
>>>>> @gmf.compartment(layout="list", collapsible="false")
>>>>> val PropertyTemplateExp[*] propertyTemplates;
>>>>> ref EClass referredClass;
>>>>> }
>>>>>
>>>>> When you generate the EMF code, you'll need to go into the
>>>>> generated ObjectTemplateExpImpl.getLabel() method, turn it to
>>>>> @generated NOT and make it return variable.name (instead of
>>>>> throwing an unsupported operation exception).
>>>>>
>>>>> Cheers,
>>>>> Dimitris
>>>>>
>>>>> Mihir wrote:
>>>>>> Hello,
>>>>>>
>>>>>> Below is the snippet from the .emf file. The output of the below
>>>>>> code resembles to the UML Object diagram where ObjectTemplateExp
>>>>>> is Object and PropertyTemplateExp is the attribute in the object.
>>>>>>
>>>>>> I want to fetch the value of attr "name" from VariableExp class
>>>>>> and show it as a label for ObjectTemplateExp node. Also, want to
>>>>>> fetch the name of the referred class so that the label pattern
>>>>>> looks like "variable : (name of referredClass)"
>>>>>>
>>>>>> Same for the label of PropertyTemplateExp "(name of
>>>>>> referredProperty) = value"
>>>>>>
>>>>>> Any help/pointers to help will be highly appreciated.
>>>>>>
>>>>>> code:
>>>>>>
>>>>>> @gmf.node(label="variable.name")
>>>>>> class ObjectTemplateExp extends ExtendedOclExp {
>>>>>> val VariableExp variable;
>>>>>>
>>>>>> @gmf.compartment(layout="list", collapsible="false")
>>>>>> val PropertyTemplateExp[*] propertyTemplates;
>>>>>> ref EClass referredClass;
>>>>>> }
>>>>>>
>>>>>> @gmf.node(label="name", label.icon="false", figure="rectangle")
>>>>>> class PropertyTemplateExp {
>>>>>> val ExtendedExp value;
>>>>>>
>>>>>> @gmf.link(target.decoration="arrow")
>>>>>> ref ecore.EStructuralFeature referredProperty;
>>>>>> }
>>>>>>
>>>>>> class VariableExp {
>>>>>> !unique !ordered attr String name;
>>>>>> }
>>>>>>
>>>>>>
>>>>>>
>>>>>> Thanks,
>>>>>> Mihir
Previous Topic:[EuGENia] Two or more compartments on canvas
Next Topic:Operation, asInteger() and EOLInteger constructor
Goto Forum:
  


Current Time: Thu Mar 28 22:45:56 GMT 2024

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

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

Back to the top