Home » Modeling » EMF » Adding attributes dinamically
|
Re: Adding attributes dinamically [message #422423 is a reply to message #422415] |
Fri, 05 September 2008 11:58 |
Ed Merks Messages: 33142 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------070809020509010604050307
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Stanislav,
To a degree it's possible because EMF supports the equivalent of XML
Schema wilcards, i.e., <xsd:any> and <xsd:anyAttribute>, but you'd
generally still have a model where the additional global elements and
attributes are defined, unless you're using demand created features.
This article will likely be useful
< http://www.theserverside.com/tt/articles/article.tss?l=Bindi ngXMLJava>
http://www.theserverside.com/tt/articles/article.tss?l=Bindi ngXMLJava
Stanislav wrote:
> Hallo,
> I have an ecore model which is used for creation of a gmf diagram. I
> need to add attributes to EClasses dynamically (as the user is
> editing the diagram). I need to have something like containers of oder
> elements. Is this possible using emf? Thanks in advance.
>
--------------070809020509010604050307
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Stanislav,<br>
<br>
To a degree it's possible because EMF supports the equivalent of XML
Schema wilcards, i.e., <xsd:any> and <xsd:anyAttribute>,
but you'd generally still have a model where the additional global
elements and attributes are defined, unless you're using demand created
features.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
| |
Re: Adding attributes dinamically [message #422429 is a reply to message #422428] |
Fri, 05 September 2008 12:58 |
Ed Merks Messages: 33142 Registered: July 2009 |
Senior Member |
|
|
Stanislav,
Comments below.
Stanislav wrote:
> Ed,
> Thanks for the answer! Comments below.
> Ed Merks wrote:
>
>> Stanislav,
>
>> To a degree it's possible because EMF supports the equivalent of XML
>> Schema wilcards, i.e., <xsd:any> and <xsd:anyAttribute>, but you'd
>> generally still have a model where the additional global elements and
>> attributes are defined,
>
> If i understood you wright there is no way to add more(or delete)
> attributes than the ones you have defined in the domain model? You can
> only use "any type" for more freedom. Because that is exactly what i
> have to do.
Don't confuse anyType with wildcards. Certainly anyType contains two
wildcards so that's a good example and that's what makes anyType behave
just like untyped DOM, but wildcards are more specific and allow you to
add attributes or elements with specific types to your own EClasses
(complex types).
>
>> unless you're using demand created features.
>
> I didn't find anything about this.
I don't get the sense you read the document I pointed you to. Look for
"demandFeature".
>
>> This article will likely be useful
>> < http://www.theserverside.com/tt/articles/article.tss?l=Bindi ngXMLJava>
>
>>
>> http://www.theserverside.com/tt/articles/article.tss?l=Bindi ngXMLJava
>
>
>> Stanislav wrote:
>>> Hallo,
>>> I have an ecore model which is used for creation of a gmf diagram. I
>>> need to add attributes to EClasses dynamically (as the user is
>>> editing the diagram). I need to have something like containers of
>>> oder elements. Is this possible using emf? Thanks in advance.
>>>
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: Adding attributes dinamically [message #422430 is a reply to message #422429] |
Fri, 05 September 2008 13:52 |
Stanislav Messages: 11 Registered: July 2009 |
Junior Member |
|
|
Thanks again Ed,
Comments below.
Ed Merks wrote:
> Stanislav,
> Comments below.
> Stanislav wrote:
>> Ed,
>> Thanks for the answer! Comments below.
>> Ed Merks wrote:
>>
>>> Stanislav,
>>
>>> To a degree it's possible because EMF supports the equivalent of XML
>>> Schema wilcards, i.e., <xsd:any> and <xsd:anyAttribute>, but you'd
>>> generally still have a model where the additional global elements and
>>> attributes are defined,
>>
>> If i understood you wright there is no way to add more(or delete)
>> attributes than the ones you have defined in the domain model? You can
>> only use "any type" for more freedom. Because that is exactly what i
>> have to do.
> Don't confuse anyType with wildcards. Certainly anyType contains two
> wildcards so that's a good example and that's what makes anyType behave
> just like untyped DOM, but wildcards are more specific and allow you to
> add attributes or elements with specific types to your own EClasses
> (complex types).
Yes I understood this but can you add this attributes after creating the
model(at runtime).
>>
>>> unless you're using demand created features.
>>
>> I didn't find anything about this.
> I don't get the sense you read the document I pointed you to. Look for
> "demandFeature".
Sorry for the misunderstanding. Where I have to call this method , and
will it help me to add new attributes which can be edited just like the
ones that are created directly from the ecore model.
Sorry for asking questions like this but I am really not sure if I am
describing my goal correctly. I need to have two main classes with or
without attributes and in runtime I have to add new classes to these two
classes(more precisely the attributes from the classes). The new
attributes must be at the properties page and can be edited.
>>
>>> This article will likely be useful
>>> < http://www.theserverside.com/tt/articles/article.tss?l=Bindi ngXMLJava>
>>
>>>
>>> http://www.theserverside.com/tt/articles/article.tss?l=Bindi ngXMLJava
>>
>>
>>> Stanislav wrote:
>>>> Hallo,
>>>> I have an ecore model which is used for creation of a gmf diagram. I
>>>> need to add attributes to EClasses dynamically (as the user is
>>>> editing the diagram). I need to have something like containers of
>>>> oder elements. Is this possible using emf? Thanks in advance.
>>>>
>>
>>
|
|
|
Re: Adding attributes dinamically [message #422432 is a reply to message #422430] |
Fri, 05 September 2008 14:11 |
Ed Merks Messages: 33142 Registered: July 2009 |
Senior Member |
|
|
Stanislav,
Comments below.
Stanislav wrote:
> Thanks again Ed,
> Comments below.
> Ed Merks wrote:
>
>> Stanislav,
>
>> Comments below.
>
>> Stanislav wrote:
>>> Ed,
>>> Thanks for the answer! Comments below.
>>> Ed Merks wrote:
>>>
>>>> Stanislav,
>>>
>>>> To a degree it's possible because EMF supports the equivalent of
>>>> XML Schema wilcards, i.e., <xsd:any> and <xsd:anyAttribute>, but
>>>> you'd generally still have a model where the additional global
>>>> elements and attributes are defined,
>>>
>>> If i understood you wright there is no way to add more(or delete)
>>> attributes than the ones you have defined in the domain model? You
>>> can only use "any type" for more freedom. Because that is exactly
>>> what i have to do.
>> Don't confuse anyType with wildcards. Certainly anyType contains two
>> wildcards so that's a good example and that's what makes anyType
>> behave just like untyped DOM, but wildcards are more specific and
>> allow you to add attributes or elements with specific types to your
>> own EClasses (complex types).
>
> Yes I understood this but can you add this attributes after creating
> the model(at runtime).
You can add attributes to an instance object based on a model of those
attributes that you create a runtime. You cannot modify an EClass
itself once instances exist.
>
>>>
>>>> unless you're using demand created features.
>>>
>>> I didn't find anything about this.
>> I don't get the sense you read the document I pointed you to. Look
>> for "demandFeature".
>
> Sorry for the misunderstanding. Where I have to call this method , and
> will it help me to add new attributes which can be edited just like
> the ones that are created directly from the ecore model.
I'm not sure how/where you are adding new attributes. The results of
calling getPropertyDescriptors item provider for the class determines
which properties are available in the properties view. You'd need to
add some logic to produce property descriptors for the additional things...
> Sorry for asking questions like this but I am really not sure if I am
> describing my goal correctly. I need to have two main classes with or
> without attributes and in runtime I have to add new classes to these
> two classes(more precisely the attributes from the classes). The new
> attributes must be at the properties page and can be edited.
You can't change an EClass's features at runtime, but you can create
derived EClasses with more features...
>
>>>
>>>> This article will likely be useful
>>>> < http://www.theserverside.com/tt/articles/article.tss?l=Bindi ngXMLJava>
>>>>
>>>
>>>>
>>>> http://www.theserverside.com/tt/articles/article.tss?l=Bindi ngXMLJava
>>>
>>>
>>>> Stanislav wrote:
>>>>> Hallo,
>>>>> I have an ecore model which is used for creation of a gmf diagram.
>>>>> I need to add attributes to EClasses dynamically (as the user is
>>>>> editing the diagram). I need to have something like containers of
>>>>> oder elements. Is this possible using emf? Thanks in advance.
>>>>>
>>>
>>>
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Goto Forum:
Current Time: Fri Apr 26 12:45:03 GMT 2024
Powered by FUDForum. Page generated in 0.05313 seconds
|